jszheng / py3antlr4book

Covert ANTLR4 book source code to Python3 version.
415 stars 93 forks source link

Where are the examples of ch9 #4

Closed wirelessr closed 8 years ago

wirelessr commented 8 years ago

Hi,

I tried to use the same python API as Java. For example,

parser.removeErrorListeners()
parser.addErrorListener(VerboseListener())

But, it does not work, and it still uses ConsoleErrorListener with outputs like:

line 1:7 token recognition error at: '('

BTW, I use python3 and antlr4 v4.5.3.

jszheng commented 8 years ago

I guess I was satisfied with the default report so skipped this chapter.

Looking into the source I find the base error listener has different name. and the two function exist, if you use pycharm, they will pop up. Just check-in my translation for your reference.