[antlr-interest] NoViableAltException in argumentList

Clifford Heath clifford.heath at gmail.com
Wed Nov 28 13:57:11 PST 2007


Lucas Ontivero wrote:
> Somebody could help me with this? I have the following rule:

Lucas,

A bug I reported a while back with ANTLRWorks is that when you are
using the interpreter to parse a fragment using any selected rule
from a larger grammar, the rule you select will look ahead one
token past the end of your input, and see the EOF. If EOF is not
a valid token to follow that rule *in the wider context* of your
grammar, the parse will fail.

So if you add a temporary rule:

junk: argumentList EOF;

then interpret the argumentList rule, you should find that the parse
succeeds.

HTH,


Clifford Heath.



More information about the antlr-interest mailing list