JavaCC lexical error for any type of spaces

I clear the unicode space characters defined in my SKIP token as follows:

SKIP { " " | "\r" | "\n" | "\t" } 

However, when I run Java CC, it parses all the tokens until I hit any of the space characters mentioned above, and this causes the following error:

 Exception in thread "main" prjct1.TokenMgrError: Lexical error at line 1, column 25. Encountered: "\r" (13), after : "Random:Word:Here" 

So you can see that it works fine until it reaches "\ r". I get the same error with "," \ n "and" \ t ". Any suggestions? Thanks

+4
source share
2 answers

Make sure you have a colon between SKIP and your bracket.

SKIP: {"" | "Foo" | "bar"}

+1
source

I had a similar problem. Check your quotes. Are they neutral quotes, such as "or double quotes left / right"?

I had double quotes, after their neutral quote, this error disappeared.

0
source

All Articles