aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/mod.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-02 19:16:28 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-02 19:16:28 -0600
commitb9ebee54da296f99ceab32c3db31ae38fe8709a1 (patch)
tree46ca4898ed23e4d1f177569b6cbf0ee850b3f4ae /src/makefile/mod.rs
parent0793cbaa213c8237a3b916b368a13727e9b643ca (diff)
downloadmakers-b9ebee54da296f99ceab32c3db31ae38fe8709a1.tar.gz
makers-b9ebee54da296f99ceab32c3db31ae38fe8709a1.zip
try expanding an unknown line first
Diffstat (limited to 'src/makefile/mod.rs')
-rw-r--r--src/makefile/mod.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs
index 9038150..9c4967a 100644
--- a/src/makefile/mod.rs
+++ b/src/makefile/mod.rs
@@ -225,12 +225,21 @@ impl<'a> Makefile<'a> {
let line_type = LineType::of(&line_tokens);
+ // before we actually test it, see if it's only visible after expanding macros
+ let (line_tokens, line_type) = if let LineType::Unknown = line_type {
+ let line_tokens = TokenString::text(self.expand_macros(&line_tokens, None)?);
+ let line_type = LineType::of(&line_tokens);
+ (line_tokens, line_type)
+ } else {
+ (line_tokens, line_type)
+ };
+
match line_type {
LineType::Rule => self.read_rule(&line_tokens, line_number, &mut lines_iter)?,
LineType::Macro => self.read_macro(&line_tokens, line_number)?,
LineType::Unknown => {
bail!(
- "error: line {}: unknown line {:?}",
+ "error: line {}: unknown line \"{}\"",
line_number,
line_tokens
);