[antlr-interest] yet more thoughts on error handling / recovery

matthew ford Matthew.Ford at forward.com.au
Tue Jun 29 02:26:05 PDT 2004


Hi Ter,
Here is what I am currently using for missing )

argList
 : l:LPAREN! (WS!)*
  (  (
        RPAREN!
     | (endArgs)=>a:attributePathOrLiteralOrKeyword (WS!)*
         (RPAREN!
          | EOF
          { throw new RecognitionException("Missing closing ) ",

                       wstLexer.getFileName(),l.getLine(),l.getColumn()+1 );
          }
         )
    )
  | EOF
   {
      throw new RecognitionException("Missing closing ) ",
                    wstLexer.getFileName(),l.getLine(),l.getColumn()+1 );
    }
   )
 ;

It would be nice to automate this a little but I think I would like control
over where
except perhaps for a general premature EOF handling.
matthew
----- Original Message ----- 
From: "Terence Parr" <parrt at cs.usfca.edu>
To: <antlr-interest at yahoogroups.com>
Sent: Tuesday, June 29, 2004 11:05 AM
Subject: [antlr-interest] yet more thoughts on error handling / recovery


> Howdy,
>
> Got some interesting details written down for error recovery and
> reporting (thinking about auto insertion/deletion for token mismatches,
> dynamic paraphrases, and dynamic resync token sets).
>
> http://www.antlr.org/blog/antlr3/error.handling.tml
>
> I would love the following (particularly for debugging grammars):
>
> line 20:12: expecting ID found LPAREN
>          at: methodDef : (access)* returnType @ ID (<args>)? "{" ...
>       input: ... public static void @ ( int x ) { float ...
>
> where the @ indicates the position.
>
> Ter
> --
> CS Professor & Grad Director, University of San Francisco
> Creator, ANTLR Parser Generator, http://www.antlr.org
> Cofounder, http://www.jguru.com
> Cofounder, http://www.knowspam.net enjoy email again!
> Cofounder, http://www.peerscope.com pure link sharing
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list