diff options
Diffstat (limited to 'src/makefile/input.rs')
-rw-r--r-- | src/makefile/input.rs | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/src/makefile/input.rs b/src/makefile/input.rs index 2c4a6bb..865b68b 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -22,7 +22,6 @@ use super::parse::{MacroAssignment, MacroAssignmentOutcome}; use super::r#macro::ExportConfig; use super::r#macro::Macro; use super::target::StaticTargetSet; -use super::token::Token; use super::{ builtin_targets, CommandLine, InferenceRule, InferenceRuleSet, ItemSource, LookupInternal, MacroScopeStack, MacroSet, Target, TokenString, @@ -58,35 +57,31 @@ impl LineType { if line_tokens.starts_with("unexport ") || line_tokens == "unexport" { return Self::Unexport; } - for token in line_tokens.tokens() { - if let Token::Text(text) = token { - let colon_idx = text.find(':'); - #[cfg(not(feature = "full"))] - let equals_idx = text.find('='); + let colon_idx = line_tokens.find(":"); + #[cfg(not(feature = "full"))] + let equals_idx = line_tokens.find('='); + #[cfg(feature = "full")] + let equals_idx = ["=", ":=", "::=", "?=", "+="] + .iter() + .filter_map(|p| line_tokens.find(p)) + .min(); + match (colon_idx, equals_idx) { + (Some(_), None) => { + return Self::Rule; + } + (Some(c), Some(e)) if c < e => { #[cfg(feature = "full")] - let equals_idx = ["=", ":=", "::=", "?=", "+="] - .iter() - .filter_map(|p| text.find(p)) - .min(); - match (colon_idx, equals_idx) { - (Some(_), None) => { - return Self::Rule; - } - (Some(c), Some(e)) if c < e => { - #[cfg(feature = "full")] - return Self::RuleMacro; - #[cfg(not(feature = "full"))] - return Self::Rule; - } - (None, Some(_)) => { - return Self::Macro; - } - (Some(c), Some(e)) if e <= c => { - return Self::Macro; - } - _ => {} - } + return Self::RuleMacro; + #[cfg(not(feature = "full"))] + return Self::Rule; + } + (None, Some(_)) => { + return Self::Macro; + } + (Some(c), Some(e)) if e <= c => { + return Self::Macro; } + _ => {} } Self::Unknown } |