[antlr-interest] ANTLR Grammar error - Illegal token.
Johannes Luber
jaluber at gmx.de
Mon Aug 4 08:13:58 PDT 2008
rkevinburton at charter.net schrieb:
> I am checking my grammar and getting the following errors:
>
> [09:11:21] error(100): ECMAScript.g:1530:2: syntax error: antlr: ECMAScript.g:1530:2: unexpected token: :
> [09:11:21] error(100): ECMAScript.g:1548:2: syntax error: antlr: ECMAScript.g:1548:2: unexpected token: :
> [09:11:21] error(100): ECMAScript.g:1555:5: syntax error: antlr: ECMAScript.g:1555:5: unexpected token: scope
>
> When I look at the lines indicated I don't see a problem. Moreover I don't see a reference to the token that is "unexpected". Would someone with more experience with ANTLR than me please look at the attached grammar and see if you can see what is wrong?
>
> Thank you.
>
> Kevin
I noticed that you use "modifier=(PUBLIC|PRIVATE)". Due to an ANTLR bug
modifier won't ever receive a value. Either
"modifier=PUBLIC|modifier=PRIVATE" or creating a new rule for
"(PUBLIC|PRIVATE)" works. Also $scope and $modifier don't have a ? in
the rewrite rules.
Testing the input I've discovered that ANTLR doesn't like
"(scope=STATIC)?" in your grammar. No idea way, as this syntax is
entirely legal. Seems to be some ANTLR bug.
BTW, do you still need help on that other issue or did you manage to
solve it yourself? I have looking at it next on my list.
Johannes
More information about the antlr-interest
mailing list