tunnelvisionlabs / antlr4ts

Optimized TypeScript target for ANTLR 4
Other
624 stars 106 forks source link

ERROR AssertionError occured in the case of `not` operator used in parser #517

Open donaldxdonald opened 2 years ago

donaldxdonald commented 2 years ago

Situation

Recently I had built a project with Antlr 4.9.2. It is all good when I made lexer and parser and it didn't show any errors from the IDE plugin. But when I run a demo and test, the error ERROR AssertionError [ERR_ASSERTION]: false == true has been showed on the console.

image

It ran when I retried the steps again tho...

Trace

I noticed that it points to the rule nonsenseParam in my project while other rules are fine. And the definition of nonsenseParam rule is as follows.

image

It used not operator in parser.

This operator is rarely used in the parser but is available. via antlr4/parser-rules

My project was used for three target languages --- TypeScript, Swift and Java. The Swift and Java version of generated parser and lexer are fine. Cuz they were generated by the official antlr4 runtime. So I reckon it is the issue of antlr4ts.