[antlr-interest] detecting rubbish data at end of input

Scott Stanchfield scott at javadude.com
Wed Jan 27 12:38:15 PST 2010


Add an EOF token to the end of your start rule
-- Scott

----------------------------------------
Scott Stanchfield
http://javadude.com



On Wed, Jan 27, 2010 at 3:36 PM, Gabriel Erzse <gabriel_erzse at yahoo.com> wrote:
> Hello,
>
> When using grammars written in ANTLR, the parser correctly recognizes
> data from an input stream, but if I have some rubbish text at the end of
> the input (which rubbish text is not supposed to be parsed by the grammar)
> the parser does not complain.
>
> I guess this behavior is all right (I mean the parser did its job and parsed
> whatever I said it should parse), but is there any trick to detect when there
> is any data left in the input after the parser has done its job?
>
> Thanks,
> Gabi.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list