irrt: normalize end-of-line characters. Closes #231

This commit is contained in:
Sebastien Bourdeauducq 2022-03-22 16:04:48 +08:00
parent 718b076e50
commit 9332d1643c
1 changed files with 3 additions and 2 deletions

View File

@ -38,11 +38,12 @@ fn main() {
})
.unwrap();
let output = std::str::from_utf8(&output.stdout).unwrap();
// https://github.com/rust-lang/regex/issues/244
let output = std::str::from_utf8(&output.stdout).unwrap().replace("\r\n", "\n");
let mut filtered_output = String::with_capacity(output.len());
let regex_filter = regex::Regex::new(r"(?ms:^define.*?\}$)|(?m:^declare.*?$)").unwrap();
for f in regex_filter.captures_iter(output) {
for f in regex_filter.captures_iter(&output) {
assert!(f.len() == 1);
filtered_output.push_str(&f[0]);
filtered_output.push('\n');