Some features which are beyond main Luacheck purpose
I wonder if it is possible to base syntax highlighting in some editor on luackeck's parser's abilities?
Another task I have is to rename all instances of some variable. Could be luacheck helpful for this?
It should be possible to use luacheck lexer for syntax highlighting. For renaming a local variable you could use lexer + parser + linearize module (it resolves identifiers to variables, among other things). I used bundled copies of these modules in depgraph library, see depgraph.scan module in particular.
Neither of these interfaces are documented. I plan to move at least the lexer and the parser into a separate module (and document it, of course) soon. For now, lexer has a comment describing what it does above lexer.next_token function, and parser AST format closely follows Metalua, but for precise details unfortunately you'll need to look through the source.
Just for future reference:
I plan to move at least the lexer and the parser into a separate module (and document it, of course) soon
Will this be in mpeterv/luasyntax? I'm quite interested in this
Also mpeterv/depgraph is great!
Yes, it will be luasyntax, progress is quite slow because I am rewriting it at the same time to make it more generally useful and extendable. I'll push out lexer soon, it's only missing tests right now. Feel free to open an issue there if you are interested in particular features!
Sounds like "soon" isn't happening quite yet, unfortunately. Work on luasyntax stopped over many doubts about the interface + ideas about error-recovering, and just not enough effort put into it. I'm sorry about that.
For now I've decided to take a more incremental approach, focusing on refactoring luacheck first instead of doing a rewrite or a fresh project.
On master I've refactored core checking and analysis modules in a way that should make them easier to use from outside: analysis and warn functionality is isolated as much as it is possible for now. src/luacheck/check.lua shows how to put the modules together, but there is no precise internal documentation for all modules yet.