[antlr-interest] token not recognized
kumarr
kumarr at utrc.utc.com
Thu Apr 22 13:04:09 PDT 2010
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.
More information about the antlr-interest
mailing list