I am trying to write a javacc based parser that includes the following tokens / lexical states:
TOKEN : { <"{"> : FIRST } <FIRST, DEFAULT> TOKEN : { <"~[]"> : DEFAULT }
Attempting to parse "{;}" results in a lexical error
Found: ";" (59), after: ""
which I do not understand. I can avoid the error in two ways:
- replacing the pattern "~ []" with explicit ";" literal
- removing the first lexical state of FIRST
However, I really need both of them (as you can guess, above all this is just a minimal test case), so this is not suitable for solving the problem. Any idea what is wrong with the token definition above?
Thanks!
source share