HaxeCheckstyle / haxe-checkstyle

Haxe Checkstyle
http://haxecheckstyle.github.io/docs
MIT License
124 stars 27 forks source link

"Parsing failed: Unexpected ï" if file has byte order mark #44

Open Gama11 opened 8 years ago

Gama11 commented 8 years ago

If checkstyle is run on a file with a byte order mark (for example this file), it causes the following error:

./source/Test.hx:1:1: error: Parsing failed: Unexpected ï
Stacktrace: 
Called from hxparse/Lexer.hx line 100
Called from Checker.hx line 104
Called from Checker.hx line 133

Checkstyle version: 191bf0c245

AlexHaxe commented 8 years ago

This should be fixed in hxparse, because if I remove the BOM from content before sending it to Lexer, all positions are off by three. And that would likely affect a lot of checks.

So the solution for now is to remove the BOM from your files.

Gama11 commented 8 years ago

Makes sense. And yeah, that's what I did. :)

Gama11 commented 8 years ago

Ping @Simn.

Simn commented 8 years ago

I don't think hxparse is the right place to fix this, haxeparser is more appropriate.