[antlr-interest] Re: exceptions in the lexer

Terence Parr parrt at cs.usfca.edu
Fri Dec 10 14:19:51 PST 2004



On Dec 10, 2004, at 1:18 PM, Paul J. Lucas wrote:

>
>
> --- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...> wrote:
>>
>> On Dec 6, 2004, at 5:58 PM, Don Caton wrote:
>>> What's the point of this?  TokenStreamRecognitionException simply
>>> wraps a
>>> RecognitionException and does not appear to add any useful
>>> functionality.
>>
>> I believe I wanted TokenStream.nextToken() to be independent of the
>> normal recognition errors etc... found in antlr's lexers; might be
>> using another tool.
>
> I'll add to the complaint about TokenStreamRecognitionException.  The 
> default parser
> recovery code only catches RecognitionException, so if a
> TokenStreamRecognitionException is thrown, it bypasses my nice 
> recovery mechanism.
> This apparently means that, every place I catch a RecognitionException 
> to recover, I must
> also now catch a TokenStreamRecognitionException.
>
> Sigh...

Hi John..er..Paul. ;)

Weird.  It does look like TokenStreamRecognitionException is outside of 
the RecognitionException.  Hmm...I know I did that for a reason, but it 
escapes me.  Regardless, your argument holds that it's a pain!

> Either TokenStreamRecognitionException needs to go away or the 
> auto-generated parser
> recovery code needs to catch TokenStreamRecognitionException in 
> addition to
> RecognitionException (and do the same recovery stuff).

Hm...perhaps I should just make it catch ANTLRException, the root, 
instead?

Ter

>
> - Paul
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
--
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!





 
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