[antlr-interest] v3 - how to disable error recovery

Terence Parr parrt at cs.usfca.edu
Tue Aug 15 11:12:15 PDT 2006


On Aug 14, 2006, at 7:49 PM, Tamas Kerecsen wrote:

> Terence,
>
> The cardinal difficulty is that Lexer.nextToken's 'throws'  
> signature doesn't allow me to throw an exception even if I override  
> it.

Oh, right!

> For the time being I hacked around this limitation by adding a new  
> member (using @lexer::members) to the lexer and overriding  
> nextToken (again, using @lexer::members) to set the new variable  
> when it encounters a recognition exception. But this isn't pretty  
> at all, so please add a more convenient mechanism down the line  
> when you get a chance...

  well, this is a very unusual situation; I think that fact is  
probably okay given its low frequency. in general people want the  
lexer to keep trying for more tokens.

Ter




More information about the antlr-interest mailing list