在javacc的Lookahead无法正常工作

时间:2015-07-06 14:02:12

标签: java parsing javacc lookahead

我正在尝试使用JAVACC解析一个简单的输入,我需要前瞻但它没有按预期工作

   LOOKAHEAD(LikeExpression())
    e=LikeExpression()    |     e=InExpression()

LikeExpression():
{..
..}
{

<LIKE>

}

InExpression():
{..
..}
{

[<NOT>]
("(")

}

INPUT:“像DELHI一样的城市”

com.sample.ParseException: Encountered " "LIKE" "like "" at line 1, column 35.
Was expecting one of:
"NOT" ...
"(" ...

0 个答案:

没有答案