From 57db2fce6f3e476d34e65b7c311c12cc9f9b71fd Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Tue, 13 Apr 2021 20:35:29 -0600 Subject: what even is comment processing anyway --- src/makefile/input.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src') 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(()) + } } -- cgit v1.2.3