Replies: 1 comment
-
In the parser the tokens inserted in recovery are not considered as ValidToken: when the ast is built the token is not processed: Maybe a different logic could in case of a recovery token build the ast with a default value:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Sometimes when typing in my dsl I have error about calling
ref
on an undefined object. It appears for example when the ID is not written in the grammar and is deduced by parsing recovery.All my code need to check if the attribute is defined before accesing the ref:
element.attribute?.ref
.In the element interface the attribute is not optional.
This behaviour can be seen in the playground: https://langium.org/playground?grammar=OYJwhgthYgBAEgUwDbIPYHU0mQEwFD6IB2ALiAJ6wCyauKAXPrC7ABQAOiIAzmsTwDUAXgAK3PsVgAfWKESJSAS2LAhwgOIgFy1QEoAVAG5C43vyatYAci7ni12MUiJhASQAiJ-Fp0rglqzWSKhojnaSwgDaZpIMngC6NgCE1t4AFkq49FKk3BAqYMiwGADKDLAA9AA6QpUmeSAFzsWeFZVRAPpgALQAXgCCPQBaCVHVAO6dCQb1hJnZJLCNzUU0ADKdAMIA8tTUAKIAcgAq7dU1BuM81aUzAPzVBhdzCznL%2BYXFpZu7%2B8dnKoXC5RAB61WI1RAMzmQA&content=A4UwTgzg9gdgBAKSgCxgKFJWiCGMRpoASIANqVIijAITFkVxpA
Generated AST:
In the last Greeting the person reference is not defined.
Beta Was this translation helpful? Give feedback.
All reactions