antlr 4.2.2 输出到控制台警告 (157) [英] antlr 4.2.2 output to console warning (157)
本文介绍了antlr 4.2.2 输出到控制台警告 (157)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我下载了最新版本的 ANTLR - 4.2.2 (antlr-4.2.2-complete.jar)当我使用它为语法文件 Java.g4 生成解析器时,它会向我打印一些警告,例如:Java.g4:525:16:规则‘表达式’在无法识别的位置包含‘assoc’终端选项"
I downloaded latest release of ANTLR - 4.2.2 (antlr-4.2.2-complete.jar) When I use it to generate parsers for grammar file Java.g4 it prints me some warnings like: "Java.g4:525:16: rule 'expression' contains an 'assoc' terminal option in an unrecognized location"
文件已生成但未编译
以前的版本工作正常.
怎么了?
推荐答案
现在应该移到表达式"的左边.
The <assoc>
should now be moved left of the "expression".
它必须始终放在周围 |
的右侧:
It must be placed always right to the surrounding |
:
看这里:https://theantlrguy.atlassian.net/wiki/display/ANTLR4/左递归+规则
...
| expression '&&' expression
| expression '||' expression
| expression '?' expression ':' expression
|<assoc=right> expression
( '='
| '+='
| '-='
| '*='
| '/='
| '&='
| '|='
| '^='
| '>>='
| '>>>='
| '<<='
| '%='
)
expression
这篇关于antlr 4.2.2 输出到控制台警告 (157)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文