简体   繁体   English

如何在此ANTLR语法中删除“不支持的选项'贪婪'”警告?

[英]How do I remove the “unsupported option 'greedy'” warning in this ANTLR grammar?

Converting ANTLR 3 to ANTLR 4. I have a gabillion warnings just like this. 将ANTLR 3转换为ANTLR 4.我有这样的gabillion警告。 I have found other SO questions about greedy but not this particular one. 我找到了关于贪婪的其他SO问题,但没有找到这个特别的问题。

table_reference: // table_ref in sql_yacc.yy, we use table_ref here for a different rule.
    table_factor ( options { greedy = true; }: join)*
;

在此输入图像描述

I have the answer for C#, 我有C#的答案,

https://blog.lextudio.com/how-to-use-antlr-4-on-net-4361915b670f https://blog.lextudio.com/how-to-use-antlr-4-on-net-4361915b670f

You might apply the same tip for other languages, 您可以对其他语言应用相同的提示,

Use *? 采用 *? instead of * as options {greedy=false} is gone. 而不是*作为选项{greedy = false}消失了。

Updated: Official documentation from ANTLR 4 is here . 更新:ANTLR 4的官方文档在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM