lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'd be really interested in a Lua 5.1 version of this!

On Tue, Sep 26, 2017 at 6:18 AM Martin <eden_martin_fuhrspam@gmx.de> wrote:
Hello list!

I've updated Lua code formatter, so now it keeps comments by default.

Requirements: Lua 5.3
License: GPLv3
Installation: sudo luarocks install lcf
Usage: lua.reformat <f_in> <f_out>

Project page: https://github.com/martin-eden/lua_code_formatter
Rockspecs: https://github.com/martin-eden/lua_code_formatter.rockspecs
Version: 5.3-2

That change required loseless Lua code parser. So now it's almost
trivial to write code highlighting and such things. For those who
interested, two shell commands provided: "lua.get_ast" and
"lua.get_formatter_ast". Both have format <f_in> <f_out> and
create file with table which represents raw AST from parser and
structured/simplified AST that is used by code formatter.

Feedback is welcome.

--[[
  There was some wishes from previous release like
    * do not export global functions
    * support command-line pipes
    * use standalone lexer
  They are not satisfied. Some I just can't implement, some I tend
  to keep because it's based on my code which I can easily reshape.
]]

-- Martin