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

Bryan Ewbank ewbank at synopsys.com
Thu Sep 30 10:18:32 PDT 2004


> 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