tunnelvisionlabs / antlr4ts

Optimized TypeScript target for ANTLR 4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

donaldxdonald opened this issue · comments

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.