[antlr-interest] how to exit when first parser error occurs

Sam Harwell sharwell at pixelminegames.com
Fri Sep 12 10:38:11 PDT 2008


I use a ReportError override to handle "flood" messages generated by
some malformed files:

 

public override void ReportError( RecognitionException e )

{

    errorCount++;

    if ( canCancelOperation && errorCount >= maxErrors )

        throw new OperationCanceledException();

    base.ReportError( e );

}

 

Then I catch the OperationCanceledException in the function that
launches the parser and deal with it appropriately.

 

Sam

 

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of harshada gune
Sent: Friday, September 12, 2008 11:49 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] how to exit when first parser error occurs

 

I got this answer for lexer error, but how to exit on parser error?

Thanks and regards,
Harshada.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080912/11a19c16/attachment.html 


More information about the antlr-interest mailing list