为什么Antlr不生成lexer Java文件? [英] Why does Antlr not generate a lexer java file?
问题描述
Antlr3不会生成Mylexer.java.我使用AntlrWorks ...
Antlr3 does not generate Mylexer.java. I use AntlrWorks...
当我的语法像这样
语法mylexer;
grammar mylexer;
它会生成myParser.java
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.
推荐答案
我找到了一种方法. AntlrWorks 1.4似乎有一个错误. 当我按ctrl + shift + G生成时,它没有给出错误消息(实际上,我认为编译是可以的),并且仅生成了一个解析器文件.发生这种情况时,光标不在源文件的第一行.
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.
当我在第一行中按ctrl + shift + G时,我收到一条错误消息,当我修复这些错误消息时, lexer文件也已生成.
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.
这篇关于为什么Antlr不生成lexer Java文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!