[antlr-interest] lexical nondeterminism between IDENT & LABEL
Monty Zukowski
monty at codetransform.com
Wed Nov 3 11:50:55 PST 2004
On Nov 3, 2004, at 4:57 AM, thoth2487 wrote:
>
> // identifier
> IDENT
> : ('a'..'z' | 'A'..'Z')
> ('a'..'z' | 'A'..'Z' | '0'..'9')*
> ;
>
> // label
> LABEL
> : ('a'..'z' | 'A'..'Z')
> ('a'..'z' | 'A'..'Z' | '0'..'9')*
> ':'
> ;
Factor it into only one rule:
// identifier or
// label
IDENT
: ('a'..'z' | 'A'..'Z')
('a'..'z' | 'A'..'Z' | '0'..'9')*
':' {$setType(LABEL);}
;
be sure to add LABEL to your tokens{} section
Monty
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