Skip to content

audit: flex review and fixes#35

Merged
theodevelop merged 2 commits intodevfrom
audit/flex-review
Apr 2, 2026
Merged

audit: flex review and fixes#35
theodevelop merged 2 commits intodevfrom
audit/flex-review

Conversation

@theodevelop
Copy link
Copy Markdown
Owner

Type of change

  • Bug fix

What does this PR do?

Proactive Flex audit — 4 fixes found and corrected on branch audit/flex-review:

  • Bug A (diagnostics.tsrawPattern()): spaces inside Flex quoted strings "hello world" were treated as pattern/action delimiters, causing false flex/unreachable-rule for distinct patterns sharing a common word prefix. Fixed by tracking inQuote depth.
  • Bug B (flexParser.ts): a standalone { on its own line (multi-line action syntax) was pushed as a spurious rule entry, causing false flex/unreachable-rule for the second and subsequent multi-line-action rules. Fixed by detecting trimmed === '{' and setting actionDepth = 1.
  • Bug C (flexParser.ts): all SC-related regex patterns used [A-Z_][A-Z0-9_]* (uppercase only). Lowercase SC names like comment were silently ignored, skipping all flex/undefined-sc / flex/unused-sc diagnostics for them.
  • Bug D (flexParser.ts): the single-tab pattern-action separator (pattern\taction) was not recognised by the old \s{2,} heuristic, so {identifier} tokens in a C action body were falsely counted as abbreviation refs, suppressing flex/unused-abbrev.
  • Cleanup (diagnostics.ts): removed two dead entries in CATCHALL_PATTERNS that contained a literal newline character and could never match a rule line

Related issue

Closes # (audit, no issue number)

How to test manually

Open tests/_test.l in VS Code — no false diagnostics should appear. Verify that GREET1/GREET2 (defined but not used as {abbr}) correctly show flex/unused-abbrev.

Checklist

  • npm run compile passes with no new errors
  • Tests added or updated (npx ts-node ...)
  • Manual test done in VS Code
  • CHANGELOG.md updated
  • No unintended files staged (node_modules, .env, dist...)

@theodevelop theodevelop merged commit 9a4ed32 into dev Apr 2, 2026
1 check passed
@theodevelop theodevelop deleted the audit/flex-review branch April 2, 2026 21:55
This was referenced Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant