StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

Stylua doesn't support other encodings, nor extraineous semicolons as lua should allow.

Open tanema opened this issue 11 months ago • 1 comments

I am writing my own lua parser and running lua validation tests imported from the lua repo. You can find these files here: https://github.com/lua/lua/tree/master/testes However stylua has some issues on parsing these files. One of the files is iso-8859-1 or ISO Latin encoded https://github.com/lua/lua/blob/master/testes/strings.lua This is seemingly done on purpose to test encodings. If you run stylua ./testes/strings.lua in the lua repo you will get an encoding error: Image

As for extraneous semicolons you can see a snippet here:

-- ./lua/testes/constructs.lua
local a
do ;;; end
; do ; a = 3; assert(a == 3) end;
;

And it will not be able to parse these as well: Image

It should however be able to parse these as these are official lua code tests.

As a note I am using the lua54 feature set installed using cargo install stylua --features lua54

tanema avatar Jan 29 '25 03:01 tanema

Thanks for raising this, sorry for the delay here.

Regarding the extraneous semicolons, I believe support for this needs to get added to our parser (full-moon: https://github.com/Kampfkarren/full-moon)

I haven't looked deeply at the different encodings issue. I'm not completely sure what we'd need to do to fix that

JohnnyMorganz avatar Apr 21 '25 13:04 JohnnyMorganz