Summary
The editor's Lezer grammar cannot parse a participant alias with a string label
(Alice as "The User"), even though the renderer (ANTLR) accepts it and draws the
labelled participant. Multi-word participant labels are a core ZenUML feature, so this
mis-parses very common, valid DSL.
Steps to reproduce
- In the editor, type
Alice as "The User" (or @Actor Alice as "The User" #FF0000).
- The Lezer parse produces an error node at
as "The User".
Expected
Clean parse: Alice is the participant Name, "The User" is its label. The ANTLR
renderer parser accepts this (oracleParticipants('Alice as "The User"') → {Alice}).
Actual
web/src/editor/grammar/zenuml.grammar line ~174:
Label { !label AsKeyword Identifier? }
as is followed by an OPTIONAL Identifier only — a String ("The User") does not
match, so the label clause fails and the parser emits an error node. Probe:
"@Actor Alice as \"The User\"" FAIL(1 error node) Participant: "@Actor Alice as"
"@Actor Alice as \"The User\" #FF0000" FAIL(2 error nodes)
"@Actor Alice" ok
"Alice as Bob" ok (bare-identifier alias only)
Location
web/src/editor/grammar/zenuml.grammar — Label { !label AsKeyword Identifier? } (~line 174).
Fix sketch
Allow the label to be an Identifier OR a String (the grammar already defines a String
token, line ~100):
Label { !label AsKeyword (Identifier | String)? }
Regenerate the parser (yarn build:grammar). Verify: @Actor Alice as "The User" #FF0000
parses with zero error nodes; the participant set stays {Alice} (subset of the ANTLR
oracle); existing label/alias and keyword behavior unchanged.
Found via the editor-improvement campaign (real-user authoring journey: multi-word labels).
Summary
The editor's Lezer grammar cannot parse a participant alias with a string label
(
Alice as "The User"), even though the renderer (ANTLR) accepts it and draws thelabelled participant. Multi-word participant labels are a core ZenUML feature, so this
mis-parses very common, valid DSL.
Steps to reproduce
Alice as "The User"(or@Actor Alice as "The User" #FF0000).as "The User".Expected
Clean parse:
Aliceis the participant Name,"The User"is its label. The ANTLRrenderer parser accepts this (
oracleParticipants('Alice as "The User"')→{Alice}).Actual
web/src/editor/grammar/zenuml.grammarline ~174:asis followed by an OPTIONAL Identifier only — aString("The User") does notmatch, so the label clause fails and the parser emits an error node. Probe:
Location
web/src/editor/grammar/zenuml.grammar—Label { !label AsKeyword Identifier? }(~line 174).Fix sketch
Allow the label to be an Identifier OR a String (the grammar already defines a
Stringtoken, line ~100):
Regenerate the parser (
yarn build:grammar). Verify:@Actor Alice as "The User" #FF0000parses with zero error nodes; the participant set stays
{Alice}(subset of the ANTLRoracle); existing label/alias and keyword behavior unchanged.
Found via the editor-improvement campaign (real-user authoring journey: multi-word labels).