Skip to content

Commit 9b7a97c

Browse files
tractorjuiceclaude
andcommitted
fix(wardley): Allow integer coordinates in annotations
Extended WARDLEY_NUMBER terminal to match both decimals (0.5) and integers (1, 100) to support annotations syntax like [1, 0]. The previous regex /[0-9]+\.[0-9]+/ only matched decimals, causing parsing errors for integer coordinates in the annotations statement. Changed to: /[0-9]+\.[0-9]+|[0-9]+/ Fixes GPT Tokeniser test which uses `annotations [1, 0]` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f0e729e commit 9b7a97c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/parser/src/language/wardley/wardley.langium

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ Deaccelerator:
104104
KW_DEACCELERATOR name=(STRING | ID | NAME_WITH_SPACES) '[' x=WARDLEY_NUMBER ',' y=WARDLEY_NUMBER ']' EOL
105105
;
106106

107-
// Define decimal number terminal for coordinates
108-
// This ONLY matches decimals like 0.5, not integers
109-
// For integers, use INT from common.langium
110-
terminal WARDLEY_NUMBER returns number: /[0-9]+\.[0-9]+/;
107+
// Define number terminal for coordinates
108+
// Matches both decimals (0.5) and integers (1, 100)
109+
// Must be defined BEFORE INT to match decimals with higher priority
110+
terminal WARDLEY_NUMBER returns number: /[0-9]+\.[0-9]+|[0-9]+/;
111111

112112
terminal ARROW: '->';
113113
terminal LINK_PORT: '+<>' | '+>' | '+<';

0 commit comments

Comments
 (0)