Open
Description
I’m not sure how applicable this is to targets other than Typescript.
If you use a label in a rule named as a reserved words, you get bad behaviour when using a token property reference.
Example:
Grammar.g4
rule: number=INT { (if $number.int==0) this.notifyErrorListeners("Error", $number, undefined);};
In the generated file you get:
if ((localctx._number != null ? Number(localctx._number.text) : 0)==0) this.notifyErrorListeners("Error", localctx._number_, undefined);
You can see that the TokenRef which uses escapedName is correct and uses _number_ but that the TokenPropertyRef which uses label is incorrect and uses _number
Metadata
Metadata
Assignees
Labels
No labels