[antlr-interest] How to handle? Synthetic token?

James Ladd james_ladd at hotmail.com
Mon Dec 20 21:15:11 PST 2010


Hi All,

I'm wondering if it is possible to add a rule or token to help trap errors?
I have the following:

temporaries
    :    '||'
    |    '|' temporaryVariables '|'
    ;

Which is fine and the allowed cases, however, I'd like to the following:

temporaries
    :    '||'
    |    '|' temporaryVariables '|'
    |    '|' temporaryVariables errorYouMissedClosingPipe
    ;

Possibly by defining errorYouMissedClosingPipe as a rule or token that matches anything but the '|'.

Is this possible and could someone provide an example or a link to a page that describes this?

Rgs, James.
 		 	   		  


More information about the antlr-interest mailing list