Why does Antlr not generate a lexer java file?

2019-08-21 03:01发布

问题:

Antlr3 does not generate Mylexer.java. I use AntlrWorks...

when I have grammar starting like

grammar mylexer;

It does generate myParser.java

It looks like a simple thing.. I wonder what may be the reason.. and the solution... I get no error message.

回答1:

I found a way. AntlrWorks 1.4 seems to have a bug. When I pressed ctrl+shift+G to generate it did not give an error message (in fact, I got that compilation was ok) and generated a parser file only. The cursor was not on the first line of the source file when that happened.

WHen I pressed ctrl+shift+G in the first line, I got an error message and when I fixed those, a lexer file was generated too.