[antlr-interest] Re: check tokens for whitespace?

mazypath eitan at cs.ucla.edu
Thu Sep 30 13:43:39 PDT 2004


Perfect!  Thank you.

I think the best way would be if I could use literals (with an AST
option) in the token definition of the lexer but this a great work around.

--- In antlr-interest at yahoogroups.com, "Bryan Ewbank" <ewbank at s...> wrote:
> > BTW, Right now the only working solution I've found is a
> > very tedious semantic predicate:
> > 
> >   VAR : {FunctionTests.isFunc(LA(1), LA(2), LA(3), LA(4))}? 
> > ('a'..'z') ('a'..'z'|'0'..'9')* { $setType(FUNC) ;} |
> > ('a'..'z') ('a'..'z'|'0'..'9')* ;
> 
> How's about this, which I use for recognizing user-defined type names:
> 
> 	VAR : ('a'..'z') ('a'..'z'|'0'..'9')*
> 		{ if (FunctionTests.isFunc($getText)) { $setType(FUNC); } }
> 
> Hope this helps,
> - Bryan Ewbank



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

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

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list