我的解析器生成器有问题(使用 javaCC)
我有这个错误:
Warning: Choice conflict involving two expansions at
line 119, column 3 and line 119, column 43 respectively.
A common prefix is: <CONSTANT>
Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
line 119, column 3 and line 119, column 43 respectively.
A common prefix is: <CONSTANT>
Consider using a lookahead of 2 for earlier expansion.
因为我的这部分代码:
TOKEN : /* OPERATORS */
{
< POINT : "." >
| < VIRGULE : "," >
}
TOKEN :
{
< CONSTANT : (< DIGIT >)+ >
| < STRING : ( ["A"-"Z","a"-"z"] )+ >
| < #DIGIT : [ "0"-"9" ] >
}
void number() :
{
}
{
(< CONSTANT > < POINT > < CONSTANT >) | (< CONSTANT >)
}
也许是因为我的表达式“|”两边都有 2 CONSTANT
我已经看到我可以使用 LOOKAHEAD 但不明白他的用途是什么
感谢您的帮助,因为我不明白:(
胡说叔叔
天涯尽头无女友
随时随地看视频慕课网APP
相关分类