I cleary have the unicode whitespace characters defined in my SKIP token like so:
SKIP {
" "
| "\r"
| "\n"
| "\t"
}
However, when I run Java CC it parses all the tokens fine until I hit any of the above mentioning white space characters and it throws the following error:
Exception in thread "main" prjct1.TokenMgrError: Lexical error at line 1, column 25. Encountered: "\r" (13), after : "Random:Word:Here"
So as you can see it runs fine until it hits the "\r". I get the same error with " ", "\n", and "\t". Any thoughts? thanks
Make sure you have a colon between the SKIP and your bracket.
SKIP: { " " | "foo" | "bar" }
I had similar problem. Check your quotes. Are they neutral quotes such as " or left/right double quotes”?
I had double quotes, after making them neutral quote, this error was gone.
来源:https://stackoverflow.com/questions/7800493/javacc-lexical-error-on-any-type-of-whitespace