[antlr-interest] Difference between * and +

Axelle Ziegler Axelle.Ziegler.01 at normalesup.org
Fri Oct 17 02:12:26 PDT 2008


Hi,
I'm feeling I'm missing something pretty fundamental here, if someone
can enlight me. I've been switching from antlr 3.0.1 to antlr 3.1 and
got some weird errors with my variable names rule. In the end, I've
narrowed it down to this small example, using antlrWorks :

grammar Test;

atoms :
VARNAME;

private MIN :('a'..'z');
private MAJ :('A'..'Z');
private CHAR :('_')|('.')|(':')|('!')|('?')|('\'');

VARNAME : MIN(MAJ|MIN|CHAR|'0'..'9')*;

Under 3.0, this (atoms rule) match "dfqsdfq" as one would expect.
Under 3.1 however, it seems that only 'd' (the first letter) is matched.
How ever the same grammar with VARNAME : (MAJ|MIN|CHAR|'0'..'9')+;
seems to work properly in both cases. (but matches variables starting
with uppercases obviously)
Is the error coming from AntlrWorks ? Am I missing something ?

Thanks for your help.


More information about the antlr-interest mailing list