diff options
author | Melody Horn <melody@boringcactus.com> | 2021-04-13 20:35:29 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-04-13 20:35:29 -0600 |
commit | 57db2fce6f3e476d34e65b7c311c12cc9f9b71fd (patch) | |
tree | cf2c20f104a45ab3ab1c0a12634e76c82ea43d8d /src/makefile | |
parent | af8b16fa1f54494eaec594ddb5212620111c887c (diff) | |
download | makers-57db2fce6f3e476d34e65b7c311c12cc9f9b71fd.tar.gz makers-57db2fce6f3e476d34e65b7c311c12cc9f9b71fd.zip |
what even is comment processing anyway
Diffstat (limited to 'src/makefile')
-rw-r--r-- | src/makefile/input.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/makefile/input.rs b/src/makefile/input.rs index 7f49bef..cb53966 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -452,7 +452,15 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { Ok(x) => x, Err(err) => return Some((n, Err(err))), }; - let line = COMMENT.replace(&line, ""); + let line = if settings.strip_comments { + COMMENT + .replace(&line, "$1") + .replace(r"\#", "#") + .trim_end() + .to_owned() + } else { + line + }; line_pieces.push(line.trim_start().to_owned()); } } @@ -1063,4 +1071,17 @@ info: Ok(()) } + + #[test] + fn sdafjijsafjdoisdf() -> R { + let file = "\ +cursed: +\techo this uses the bash variable '$$#' and all that \\ +\techo yeah its value is $$# and it's really cool +"; + let args = Args::empty(); + let makefile = MakefileReader::read(&args, MacroSet::new(), Cursor::new(file), "")?; + let makefile = makefile.finish(); + Ok(()) + } } |