[antlr-interest] line 0:-1 mismatched input '<EOF>'

shmuel siegel antlr at shmuelhome.mine.nu
Wed Jan 30 05:51:48 PST 2008


Seems a little strange to want WS as part of Title yes mark it as a 
skipped token.
It would be better to make Title a parser rule (use title instead of 
Title) and remove WS from the rule.

Anuj Mehta wrote:
>
> Hi
>
> I wrote a grammar for parsing a small text but getting following error.
>
> Please guide me where I am going wrong?
>
> Error:-
>
> recoverFromMismatchedToken
>
> BR.recoverFromMismatchedToken
>
> line 0:-1 mismatched input '<EOF>' expecting Title
>
> Input Text:-
>
> Kernel IP routing table
>
> Destination Gateway
>
> Grammar:
>
> grammar route;
>
> expr : Heading Title {System.out.println(“done”);};
>
> Heading : 'Kernel IP routing table';
>
> Title : 'Destination' WS 'Gateway';
>
> WS : (' '|'\t'|'\n'|'\r')+ {skip();};
>
> Regards,
>
> Anuj Mehta
>




More information about the antlr-interest mailing list