diff --git a/compiler/pp/command.go b/compiler/pp/command.go index 75e2753..80b3a15 100644 --- a/compiler/pp/command.go +++ b/compiler/pp/command.go @@ -81,13 +81,19 @@ func ParseRule(directive string, isCommand, caseSens bool) *Rule { ResultTmpl: result, } - // Extract first keyword for fast matching + // Extract first keyword for fast matching. The first whitespace- + // delimited token of the pattern becomes the dispatch key; we + // strip marker wrappers and any trailing `(` so a pattern like + // `MAKE_TEST( , )` hashes on `MAKE_TEST`, matching how + // firstToken normalises source lines. words := strings.Fields(pattern) if len(words) > 0 { kw := words[0] - // Remove marker brackets kw = strings.TrimLeft(kw, "<[") kw = strings.TrimRight(kw, ">]") + if idx := strings.IndexByte(kw, '('); idx >= 0 { + kw = kw[:idx] + } if !strings.ContainsAny(kw, "!*,:") { rule.Keyword = kw }