[antlr-interest] Parsing a file

Yuri Tijerino yuri at tijerino.net
Wed Nov 12 09:29:02 PST 2008


Well, suppose it does.  It is just an example for my question. Or if 
your prefer you can change this definition to:

HOURNUM : '0'..'9' | '1' '0'..'2' ;

I remember something in one of Terrence's blog a while back where he 
used something like:

decl (';' decl)*

in the main rule instead of

decl+

together with a catch statement for  NoViableAltException.  But I think 
I had to declare an ListArray with all the possible stop tokens.  
However this didn't work in my case becase I don't have anything that 
corresponds to a  ';' in between statements.

What I really want is change the default behavior and throw away the 
tokens that cause the exception and continue parsing the input after 
those tokens as if it was a new input.  Is this even possible? Terrence?

Yuri Tijerino

Gavin Lambert wrote:
> At 18:59 12/11/2008, Yuri Tijerino wrote:
> >HOURNUM
> >  :
> >    '0'..'12'
> >  ;
>
> That doesn't mean what you seem to think it means.  In fact I'm not 
> convinced it means anything sensible at all :)
>
>


More information about the antlr-interest mailing list