[antlr-interest] query regarding lexer

elango m go2elango at gmail.com
Sat Apr 19 13:12:08 PDT 2008


I need to neglect other lexer rules when I encounter a lexical token.

The following snippet works for me. But I am sure there should be a better
way of doing this.

commandline : CMD ' ' CMD_ARG;
CMD : 'command'
CMD_ARG : ('a'..'z' | 'A'..'Z' | '0'..'9' | ' ' | '/')* ;

Ex :
command blah blah blah blah..

should parse resulting two tokens 1) command and 2) rest of the string (blah
blah blah blah..). this can include any special character

Any help will be greatly appreciated.

-EM-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080420/41ea8ccb/attachment.html 


More information about the antlr-interest mailing list