From db1a255223cc0e8d905c50df16fbef5d21185e2e Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sat, 16 May 2026 19:15:34 +0200 Subject: [PATCH] fix(editor): drop dead `-?` from srccfg number regex The `\b` word boundary anchor prevents the optional minus from ever matching from positions where signed numbers naturally appear (` -1`, `(-1`, `=-1` all word-boundary-from-non-word and the `-?` fires zero chars). Negative numbers are tokenised via the operator class instead, which is the consistent behaviour the grammar already exhibits. Plan source block updated to match so a fresh regeneration produces the same file. Addresses Minor #1 from the Task 2 code review. Co-Authored-By: Claude Opus 4.7 (1M context) --- docs/superpowers/plans/2026-05-16-textarea-code-editor.md | 2 +- l4d2web/l4d2web/static/js/srccfg-grammar.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/superpowers/plans/2026-05-16-textarea-code-editor.md b/docs/superpowers/plans/2026-05-16-textarea-code-editor.md index 3688968..f4e7974 100644 --- a/docs/superpowers/plans/2026-05-16-textarea-code-editor.md +++ b/docs/superpowers/plans/2026-05-16-textarea-code-editor.md @@ -207,7 +207,7 @@ Create `l4d2web/l4d2web/static/js/srccfg-grammar.js`: greedy: true, }, keyword: /\b(?:exec|alias|bind|unbind|toggle)\b/, - number: /\b-?\d+(?:\.\d+)?\b/, + number: /\b\d+(?:\.\d+)?\b/, identifier: /\b[a-zA-Z_][a-zA-Z0-9_]*\b/, operator: /[+\-;]/, }; diff --git a/l4d2web/l4d2web/static/js/srccfg-grammar.js b/l4d2web/l4d2web/static/js/srccfg-grammar.js index 7f8326e..d6eb9c9 100644 --- a/l4d2web/l4d2web/static/js/srccfg-grammar.js +++ b/l4d2web/l4d2web/static/js/srccfg-grammar.js @@ -10,7 +10,7 @@ greedy: true, }, keyword: /\b(?:exec|alias|bind|unbind|toggle)\b/, - number: /\b-?\d+(?:\.\d+)?\b/, + number: /\b\d+(?:\.\d+)?\b/, identifier: /\b[a-zA-Z_][a-zA-Z0-9_]*\b/, operator: /[+\-;]/, };