mpeterv / luacheck

A tool for linting and static analysis of Lua code.
MIT License
1.92k stars 321 forks source link

luacheck doesn't allow non-ascii symbols in unquoted strings #207

Closed ligurio closed 3 years ago

ligurio commented 4 years ago

non-ascii symbols in Привет = 1 triggers error in luacheck:

Checking r.lua                                    1 error

    r.lua:1:1: expected statement near 'П'

Total: 0 warnings / 1 error in 1 file

To workaround one can use quotes: ['Привет'] = 1.

Luacheck: 0.23.0 Lua: LuaJIT 2.1.0-beta3 Argparse: 0.6.0

alerque commented 3 years ago

This isn't an error in luacheck, this is something that Lua itself does not allow:

$ lua -e 'Привет = 1'         
lua: (command line):1: unexpected symbol near '<\208>'

Quoting it as table key is the correct idiomatic solution.

You may not be aware but the original maintainer of this project passed away (see #198). since nobody is able to close issues here except the people that opened them I would request your help tidying up by closing this issue.

If you feel there is something that needs more attention or something Lua allows that isn't being caught please open an issue on the new official repository here.

ligurio commented 3 years ago

This isn't an error in luacheck, this is something that Lua itself does not allow:

It is valid for PUC Rio Lua, LuaJIT allow to use it.

$ luajit -v
LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
$ luajit -e 'Привет = 1'  
$ luajit -e 'Привет = 1 print(Привет)'  
1
$ 
alerque commented 3 years ago

Well that's interesting, and something I didn't know about LuaJIT!

My other point still stands, we have no access to manage issues on this repository. Can you please copy the relevant info from above into a new issue here and close this one? We can look into how to accommodate different interpreter handling there. Thanks.