kevin sufferdini
kevin sufferdini

Reputation: 121

JavaCC lexical error on any type of whitespace

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

Upvotes: 3

Views: 3017

Answers (2)

Chris Gambrell
Chris Gambrell

Reputation: 291

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

SKIP: { " " | "foo" | "bar" }

Upvotes: 1

Meera Datey
Meera Datey

Reputation: 2020

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.

Upvotes: 0

Related Questions