Skip to content

Commit 4fe0fd5

Browse files
tractorjuiceclaude
andcommitted
fix(wardley): Allow parentheses after spaces in component names
Fixed NAME_WITH_SPACES terminal regex to allow parentheses, digits, and underscores after spaces. This enables component names like "byte pair encoding (BPE)" to parse correctly. Previously, the pattern required letters after spaces which rejected component names with parentheses like "(BPE)" after spaces. Changed pattern from: (?:[ \t]+[A-Za-z][A-Za-z0-9_()&]*)* To: (?:[ \t]+[A-Za-z0-9_()&]+)* Fixes E2E test "should render GPT Tokeniser Architecture" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent dd44d57 commit 4fe0fd5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ terminal KW_DEACCELERATOR: 'deaccelerator';
134134

135135
// NAME_WITH_SPACES must be defined LAST to avoid shadowing other terminals
136136
// Uses negative lookahead to exclude matching content that starts with reserved keywords
137-
// Matches names like "Campfire Kettle" but NOT "Kettle 0.5" (stops before numbers after spaces)
138-
// Pattern: letter, then any combo of letters/digits/_, then optionally (space/tab + letters/digits/_) repeating
137+
// Matches names like "Campfire Kettle" and "byte pair encoding (BPE)"
138+
// Pattern: letter, then any combo of letters/digits/_()&, then optionally (space/tab + any of those) repeating
139139
// Uses [ \t]+ instead of \s+ to avoid matching newlines
140-
terminal NAME_WITH_SPACES: /(?!title\s|accTitle|accDescr)[A-Za-z][A-Za-z0-9_()&]*(?:[ \t]+[A-Za-z][A-Za-z0-9_()&]*)*/;
140+
terminal NAME_WITH_SPACES: /(?!title\s|accTitle|accDescr)[A-Za-z][A-Za-z0-9_()&]*(?:[ \t]+[A-Za-z0-9_()&]+)*/;
141141
// Removed EVOLUTION_NAME and COMPONENT_NAME terminals - they were too greedy
142142
// and shadowed imported terminals from common.langium (like TITLE)
143143
// Now using ID for evolution names and STRING for component names

0 commit comments

Comments
 (0)