Refine patterns. Do not match commented lines.

This commit is contained in:
2026-03-02 15:01:44 +01:00
parent d00aa2666d
commit 3d5a124321
3 changed files with 5 additions and 4 deletions

View File

@@ -2,6 +2,5 @@ calc_rate
qmdffgen
dynamic
evbopt
explore
black_box
poly_qmdff

View File

@@ -1 +1 @@
lmp
\blmp\s+

View File

@@ -64,9 +64,11 @@ func (t *AppTagger) scanApp(f *os.File, fns string) {
if line == "" {
continue
}
re, err := regexp.Compile(line)
// Wrap pattern to skip comment lines: match only if not preceded by # on the same line
wrapped := `(?m)^[^#]*` + line
re, err := regexp.Compile(wrapped)
if err != nil {
cclog.Errorf("invalid regex pattern '%s' in %s: %v", line, fns, err)
cclog.Errorf("invalid regex pattern '%s' (wrapped: '%s') in %s: %v", line, wrapped, fns, err)
continue
}
ai.patterns = append(ai.patterns, re)