[antlr-interest] check tokens for whitespace?

mazypath eitan at cs.ucla.edu
Thu Sep 23 16:05:00 PDT 2004

Sorry if this is a newbie question but I can't seem to find an answer
in the docs or online.

Is there anyway to define a token as a string and to only have have
that string recognized as a token if it is not followed by whitespace?

For example if I define the Lexer as follows:
  class L extends Lexer;

  FUNC : "plus";
  WS : ( ' '| '\t' | '\f') { $setType(Token.SKIP); }
  VAR : ('a'..'z') ('a'..'z'|'0'..'9')*;

Can I get the Lexer to parse the string "plus1" as a VAR token and not
a FUNC token followed by "1"?

Thanks in advance!

Yahoo! Groups Links

<*> To visit your group on the web, go to:

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

More information about the antlr-interest mailing list