[antlr-interest] Missing error when tokens are left to parse

Arne Schröder arne.schroeder at gmail.com
Wed Jan 20 03:58:27 PST 2010

Thank you for your help.

It now works insofar as the parser now throws an error-message when not
encountering EOF after all rules are finished.

On Fri, Jan 15, 2010 at 12:10 PM, Gavin Lambert <antlr at mirality.co.nz>wrote:

> At 22:43 15/01/2010, Arne Schröder wrote:
> >file    : section1 section2?
> >        ;
> [...]
> >If I now try to parse "Section1 bla()) Section2" something similar
> >happens:
> >It parses up to the second ")" and then decides to skip the rest.
> >And I definitely do not want the second ")" to be there i.e. want
> >it to throw a recognition-error and recover itself.
> Try adding EOF to the end of your top-level rule.  Without that, ANTLR
> assumes that it is not required to parse all the input, so if it
> successfully parses a section1 it will just decide that the section2 has
> been omitted (since it's optional).

More information about the antlr-interest mailing list