[antlr-interest] unget a character
parrt at cs.usfca.edu
Thu Dec 23 10:41:19 PST 2004
On Dec 22, 2004, at 11:52 AM, Paul J. Lucas wrote:
> It's not clear where/when to set call mark() in my case. In my
> case, the token in the 'B' lexer is:
> : '}'
> If 'B' ever sees '}', it's wrong. I need to pop 'B' switching
> back to 'A' then have 'A' see the '}'.
> So where do I call mark() and rewind() ?
Hmm...it seems you'll need mark/rewind to change the shared input
stream state and retry exception or your own retry mechanism to make
this work. My only experience is javadoc like stuff where the sentinel
tokens are used to merely switch lexers not rewind switch.
Sorry I can't be of more help. I, myself, would have to look at the
rewind stuff to figure out how to tweak it.
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.knowspam.net enjoy email again!
More information about the antlr-interest