[antlr-interest] Why I have to use explicitly $setType()?
    ycmichelid 
    michel_cedric at hotmail.com
       
    Mon Feb 11 06:07:58 PST 2002
    
    
  
My problem (http://groups.yahoo.com/group/antlr-interest/message/5028)
seems to be also a conflict between keyword and identifier.
I found a solution to make my tokens being recognized normally.
I have to explicitly use the function $setType().
In my case , rules in my lexer become (rule to skip whitespace
ignored):
ALERT: "Alert" {$setType(TestTokenTypes.ALERT);};
OPENPAR : "(" {$setType(TestTokenTypes.OPENPAR);};
FUNCNAME : ('A'..'Z')( 'a'..'z' | 'A'..'Z' | '0'..'9' | '_' )+
           {$setType(TestTokenTypes.FUNCNAME);}
;
So, it works now.
But why do i have to set the type of the tokens manually?
 
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
    
    
More information about the antlr-interest
mailing list