langium icon indicating copy to clipboard operation
langium copied to clipboard

Broken cstNode calculation

Open cdietrich opened this issue 1 year ago • 2 comments

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

cdietrich avatar Jan 29 '24 08:01 cdietrich

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

msujew avatar Jan 31 '24 10:01 msujew

It also seems to be related to #1218.

lars-reimann avatar Feb 02 '24 18:02 lars-reimann

thx for fixing

cdietrich avatar Jun 18 '24 15:06 cdietrich