On Mon, Dec 20, 2010 at 10:56 PM, James Ladd wrote:
>
> Maybe I have answered my own question:
>
> temporaries
> : '||'
> | '|' temporaryVariables '|'
> | '|' temporaryVariables errorYouMissedClosingPipe
> ;
>
> <snip>
>
> errorYouMissedClosingPipe
> : ~('|' | NAME)
> ;
>
> When I use the NOT token I get the correct parsing.
> For example, this is not correct: | foo bar [
>
> *note: the things that are not '|' or NAME need to be matched as well.
> So in the example I gave '[' has to be a matched token.
>
> My question not is: Is this an ok approach / thing to do?
I'm far from an expert on ANTLR, but I believe this is sorta taken
care of for you.
See: http://www.antlr.org/wiki/display/ANTLR3/FAQ+-+Error+handling
For some examples of ways to handle this that aren't as fragile.
:Den
--
He who speaks evil only differs from his who does evil in that he
lacks opportunity.
Marcus Fabius Quintilian
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.