[antlr-interest] MismatchedTokenException

Terence Parr parrt at cs.usfca.edu
Fri Dec 29 18:46:26 PST 2006


.* matches until EOF, which iswhat you see.  See the examples or use  
(options{greedy=false;}:.)* for more interesting results. :)
Ter
On Dec 29, 2006, at 6:41 PM, Ayal Spitz wrote:

> Does anyone know if there is a way to get the incomplete token that  
> is causing the parser to throw a MismatchedTokenException?
>
> Here is what I'm doing. I have the following grammar:
> parser	:	STRING;
> STRING	:	'"' .* '"';
>
> When I parse the following text:
> "Test
>
> I get the MismatchedTokenException. The token tied to the exception  
> looks like this:
> [@-1,0:0='<no text>',<-1>,0:-1]
>
> What I really need is the token that represents the incomplete  
> STRING token.
>
> Anyone have any ideas how to get this?
>
> Thanks - AYAL



More information about the antlr-interest mailing list