forked from M-Labs/nac3
core: build.rs rewrite regex to capture `= type`
This commit is contained in:
parent
e9cf6ce1e5
commit
1303265785
|
@ -53,7 +53,11 @@ fn compile_irrt(irrt_dir: &Path, out_dir: &Path) {
|
||||||
let output = std::str::from_utf8(&output.stdout).unwrap().replace("\r\n", "\n");
|
let output = std::str::from_utf8(&output.stdout).unwrap().replace("\r\n", "\n");
|
||||||
let mut filtered_output = String::with_capacity(output.len());
|
let mut filtered_output = String::with_capacity(output.len());
|
||||||
|
|
||||||
let regex_filter = Regex::new(r"(?ms:^define.*?\}$)|(?m:^declare.*?$)").unwrap();
|
// (?ms:^define.*?\}$) to capture `define` blocks
|
||||||
|
// (?m:^declare.*?$) to capture `declare` blocks
|
||||||
|
// (?m:^%.+?=\s*type\s*\{.+?\}$) to capture `type` declarations
|
||||||
|
let regex_filter =
|
||||||
|
Regex::new(r"(?ms:^define.*?\}$)|(?m:^declare.*?$)|(?m:^%.+?=\s*type\s*\{.+?\}$)").unwrap();
|
||||||
for f in regex_filter.captures_iter(&output) {
|
for f in regex_filter.captures_iter(&output) {
|
||||||
assert_eq!(f.len(), 1);
|
assert_eq!(f.len(), 1);
|
||||||
filtered_output.push_str(&f[0]);
|
filtered_output.push_str(&f[0]);
|
||||||
|
|
Loading…
Reference in New Issue