Hi all,

I have defined a token called GEN that can take on various string values.
The grammar is below.

The token is question is GEN. I'm trying to parse a very simple string
conforming to this grammar: "Unavailable(LEP)". When it sees "LEP" it
complains that it found 'LEP' when it was expecting GEN. The error message
is:

line 1:13 mismatched input 'LEP' expecting GEN

I don't understand this. I have defined "LEP" as one of the values that GEN
can take!!

The same problem happens for "Unavailable(REP)". The inputs
"Unavailable(VFSG_L1)", "Unavailable(VFSG_L2)" etc are parsed without
errors.

does anyone know what could be gong on?
Thanks.
Rajesh

**********************grammar            Expression2; 

prog    
        :       exp

        ;
        
exp     
        : atomic_expr 
        | 
        ;
        

atomic_expr 
        :        ID 
        |       ID '>' NUM 
        |       ID '<' NUM 
        |       'Unavailable' '(' GEN ')'
        ;

ID      :        ('a'..'z'|'A'..'Z')('a'..'z'|'A'..'Z'|'0'..'9')*
        ;

NUM     :       ('0'..'9')+
        ;
        
GEN     :     'VFSG_L1'
        |       'LEP'
        |       'REP'
        |       'VFSG_L2'
        |       'VFSG_R1'
        |       'VFSG_R2'
        |       'ASG_L'
        |       'ASG_R' 
        ;
        
BUS     :       'L1_V235_bus'
        |       'L2_V235_bus'
        |       'R1_V235_bus'
        |       'R2_V235_bus'
        |       'Backup_bus'
        ;
        
WS      :       (' '|'\t'|'\n')+ {skip();};

*****************************************
-- 
View this message in context: 
http://antlr.1301665.n2.nabble.com/token-not-recognized-tp4946875p4946875.html
Sent from the ANTLR mailing list archive at Nabble.com.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/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.

Reply via email to