From 65e4eb4c1aea40b98595ea5ad88b6e8cde8fe473 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Fri, 26 Mar 2021 21:30:49 -0600 Subject: allow blank lines in rules --- src/makefile/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/makefile') diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs index 4c39160..359355e 100644 --- a/src/makefile/mod.rs +++ b/src/makefile/mod.rs @@ -371,9 +371,13 @@ impl Makefile { let prerequisites = self.expand_macros(&prerequisites, None); let prerequisites = prerequisites.split_whitespace().map(|x| x.into()).collect::>(); - while lines_iter.peek().and_then(|(_, x)| x.as_ref().ok()).map_or(false, |line| line.starts_with('\t')) { + while lines_iter.peek().and_then(|(_, x)| x.as_ref().ok()) + .map_or(false, |line| line.starts_with('\t') || line.is_empty()) { let line = lines_iter.next().unwrap().1.unwrap(); - let mut line: String = line.strip_prefix("\t").unwrap().into(); + let mut line: String = line.strip_prefix("\t").unwrap_or(&line).into(); + if line.is_empty() { + continue; + } while line.ends_with('\\') { match lines_iter.next() { Some((_, Ok(next_line))) => { -- cgit v1.2.3