Error - Action in lexer rule 'xxxx' must be last element of single
outermost alt
When I upgraded from Antlr 3 to Antlr 4, I removed all the syntactic
predicates in the grammar. But when I changed it, I am getting an error as
mentioned in the title.
This is the changed code
NUMBER
:(
'0'..'9' ('.' '0'..'9'+)?
| '.' '0'..'9'+
)
(
E
(
M { $type = EMS; }
| X { $type = EXS; }
)
| P
(
X
| T
| C
)
{ $type = LENGTH; }
| C M { $type = LENGTH; }
| M
(
M { $type = LENGTH; }
| S { $type = TIME; }
)
| I N { $type = LENGTH; }
| D E G { $type = ANGLE; }
| R A D { $type = ANGLE; }
| S { $type = TIME; }
| K? H Z { $type = FREQ; }
| IDENT { $type = DIMENSION; }
| '%' { $type = PERCENTAGE; }
| // Just a number
)
;
This is the error I am getting.
I saw an answer to this question here. But I was unable to grasp what it
meant. Please give me some guidance.
No comments:
Post a Comment