[antlr-interest] Java grammar accepting junk

Terence Parr parrt at cs.usfca.edu
Fri Aug 15 16:17:05 PDT 2008


On Aug 15, 2008, at 4:03 PM, Ron Hunter-Duvar wrote:

> Funny, I went looking for just such a method and didn't find one.  
> Now I go back and see exactly the code you pointed to. Accomplishes  
> the same thing with slightly less code.
>
> About my other question, though, if errors have occurred, with  
> backtracking and recovery going on, how can I know if it succeeded  
> in recovering and got to the end of file or just gave up early?

it only counts real errors not backtracking errors :)  you can also  
ask for state.input.index() to get the token index.

Ter


More information about the antlr-interest mailing list