eclipse-langium / langium

Next-gen language engineering / DSL framework
https://langium.org/
MIT License
665 stars 61 forks source link

Broken cstNode calculation #1361

Closed cdietrich closed 2 weeks ago

cdietrich commented 5 months ago

given the grammar

grammar HelloWorld

entry Expression:
    HasValue;

HasValue infers Expression:
    DotExpression({infer HasValue.left=current} 'has-value')*;

DotExpression infers Expression:
    RefExpression ({infer DotExpression.base = current} '.' target=DotTarget)*;

RefExpression:
    target=ID;

DotTarget:
   {infer DotTargetRef} ref=ID;

ID returns string: RawId | EscapedId;

hidden terminal WS: /\s+/;
terminal RawId: /[_a-zA-Z][\w_-]*/;
terminal EscapedId: /`[^`]*`/;

hidden terminal ML_COMMENT: /\/\*[\s\S]*?\*\//;
hidden terminal SL_COMMENT: /\/\/[^\n\r]*/;

and sample model

bs.cs.xx has-value

the cst-node for the dot expression

bs.cs.xx

is .xx and as not expected bs.cs.xx

msujew commented 5 months ago

Might be related to https://github.com/eclipse-langium/langium/pull/932.

lars-reimann commented 5 months ago

It also seems to be related to #1218.

cdietrich commented 2 weeks ago

thx for fixing