naclsn/pico8code

Incorrectly flags string decorator

Closed this issue · 3 comments

Another P8 language server plugin has a similar problem.
Zep added string decorators, one of which is the combination \^
The use of this decorator causes this plugin to complain
SyntaxError: invalid escape sequence

Thanks for reporting!

This has to do with the underlying parser (pico8parse) which poorly handles P8SCII.

In this case, \^ requires a command character.
print("\^") will raise the SyntaxError you saw, but for example print("\^1") shouldn't.

I'll either update pico8parse properly, or remove checking for escape correctness altogether...

Well, I didn't put the full string I was using down, but I wasn't trying to print just the raw \^ without the command characters.

For example, with "one off characters" like the cat example Zep gives
print("\^:447cb67c3e7f0106") , this will raise the SyntaxError.

This should be "fixed" in 0.0.5 (ie. it no longer complains).