[antlr-interest] Ignoring comments in predicates problem

Martin Probst mail at martin-probst.com
Mon Jan 31 14:14:33 PST 2005


Hi,
as I wrote to Paul in an accidental off-list message (maybe some day
I'll learn how to use my email program ... maybe) I ran into this too.

In my Lexer I've had:
NEXT:
	(...)
	APOS_ATTR_CONTENT
	| APOS

protected APOS_ATTR_CONTENT:
	  ENTITY
	| CHAR_REF
	| ESCAPED_APOS
	| ( ... more CHARS ... )

protected ESCAPED_APOS:
	'\''! '\'',

With k=2 this generated something like:
if (LA(1) == '\'')
	mESCAPED_APOS();

I would expect it to stop matching APOS_ATTR_CONTENT when it sees a
single APOS and return a new token, then match the APOS as a single
token. If I find the time tomorrow I might narrow it down to a single
test.

Regards,
Martin



More information about the antlr-interest mailing list