[antlr-interest] lexical question

Stephen Siegel siegel at udel.edu
Tue May 29 17:24:15 PDT 2012


Consider the following grammar:

--------------------------------------
grammar dots;

r	:	(DOT | ELLIPSIS)*;

DOT	:	'.';
ELLIPSIS:	'...';
--------------------------------------

When given input "..", ANTLR says "expecting '.' but saw 'EOF'".
What I would like it to see is two DOTs.
What would be the "right" way to fix the problem?  Backtrack=true?
Thanks,
Steve




More information about the antlr-interest mailing list