为什么 Antlr 不生成词法分析器 java 文件?

发布于 2024-09-03 00:15:26 字数 184 浏览 2 评论 0原文

Antlr3 不会生成 Mylexer.java。我使用 AntlrWorks...

这样的语法开头时

当我有像Grammar mylexer

;它确实生成了 myParser.java

它看起来很简单。 我想知道可能是什么原因......以及解决方案...... 我没有收到任何错误消息。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故事↓在人 2024-09-10 00:15:26

我找到了办法。
AntlrWorks 1.4 似乎有一个错误。
当我按 ctrl+shift+G 生成它时,它没有给出错误消息(事实上,我得到编译没问题)并且仅生成了一个解析器文件。发生这种情况时,光标不在源文件的第一行。

当我在第一行按 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.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文