[antlr-interest] Failing upon illigal input termination

Johannes Luber jaluber at gmx.de
Thu Nov 6 12:12:18 PST 2008


Vitaliy schrieb:
> Gavin,
> 
> Thanks so much!!!
> That did it!
> 
> Wasted so much time on this one..
> Wonder why this is not the default behavior?

Because ANTLR doesn't know which rule should be the starting rule. Using
an option to specify this rule falls short for people who need several
rules with EOF. Then again those people may not use such an option anyway.

Johannes
> 
> Anyway, Thanks again!!
> 
> Vitaliy
> 
> -----Original Message-----
> From: Gavin Lambert [mailto:antlr at mirality.co.nz]
> Sent: Thursday, November 06, 2008 09:41
> To: Vitaliy; antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Failing upon illigal input termination
> 
> At 04:55 6/11/2008, Vitaliy wrote:
>> That is, If we've got the input:
>> LegalStatement1,
>> LegalStatement2,
>> ...
>> LegalStatementN,
>> IllegalStatement,
>>
>> Antlr would stop on LegalStatementN,
>> Instead of reporting an error for IllegalStatement.
>>
>> What can I do to achieve this behavior?
> 
> Add EOF to the end of your top-level parser rule.
> 
> 
> 
> 
> 
> 
> __________ Information from ESET NOD32 Antivirus, version of virus signature database 3589 (20081106) __________
> 
> The message was checked by ESET NOD32 Antivirus.
> 
> http://www.eset.com
> 
> 
> 
> __________ Information from ESET NOD32 Antivirus, version of virus signature database 3591 (20081106) __________
> 
> The message was checked by ESET NOD32 Antivirus.
> 
> http://www.eset.com
> 
> 
> 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