On Wed, 2008-12-03 at 14:57 +0800, chain one wrote:
> Sorry for spaming
>
>
>
> I noticed that only to remove the '$' in front of getText and
> setType() would work.
> What a stupid question! : )
>
Actually, you should not do that in V3 lexers :-) You hsoudl use:
System.out.println($text);
and
$type = MY_INT_TYPE;
Jim
> 2008/12/3 chain one <[EMAIL PROTECTED]>
>
> The V2 Lexer rule is:
>
>
>
> IDENT
>
>
> : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*
> {
> if (!parser.isFirst) $setType(globalSearchId($getText()));
> }
> ;
>
>
>
>
> I searched in the ANTLR V3 book but failed to find the way to
> get the Lexer rule's Text and Type directly from
> its alternatives.
>
>
> Anyone who knows , could you please drop me an email?
> Thanks very much!
> Best Regards,
> Chainone
>
>
>
>
>
>
> List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address