Skip to content

Editor grammar rejects string participant labels (Alice as "The User") that the renderer accepts #808

@MrCoder

Description

@MrCoder

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

  1. In the editor, type Alice as "The User" (or @Actor Alice as "The User" #FF0000).
  2. 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.grammarLabel { !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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions