[antlr-interest] Newby Lexer Question

Daniel Rippel drippel at yahoo.com
Fri Dec 3 07:05:54 PST 2010



I am fairly new to antlr and am running into a basic issue that I can't quite 
find the answer for on the wiki and in Parr's book.

Here is my lexer.  Greatly simplified of course.

...
CREATE : 'create' ;
...
IDENTIFIER : (['a'..'z']|['A'..'Z'])(['a'..'z']|['A'..'Z']|['0'..'9'])+ ;

Basically, I want 'create' to be a keyword token.
And something like 'createFoo' should be an identifier.

However, the lexer always finds 'create' stops and gives me the CREATE token 
back.

I have tried using the greedy flag but am not having any luck.

Any ideas or suggestions would be extremely helpful.  
I'll even accept an RTFM, if you can point me to the page in the FM.

Thanks,
Dan



More information about the antlr-interest mailing list