Search code examples
javaantlr3antlrworks

Why does Antlr not generate a lexer java file?


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.


Solution

  • 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.