[antlr-interest] Java grammar accepting junk

Terence Parr parrt at cs.usfca.edu
Mon Aug 18 09:41:01 PDT 2008


On Aug 18, 2008, at 8:13 AM, Ron Hunter-Duvar wrote:
>> it only counts real errors not backtracking errors :)  you can also  
>> ask for state.input.index() to get the token index.
>>
>> Ter
>>
> So a real error means the parser really did give up before the end  
> of the file was reached?

A real error is well, an error when not backtracking...nothing to do  
with giving up. t hat is recovery not reporting.

> If so, then what I have is sufficient.
>
> Not sure what the token index would tell me. Do you mean use that  
> index to get the token and check if it's an EOF token?

See if you stopped before index.size().
Ter


More information about the antlr-interest mailing list