lua-users home
lua-l archive

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


Hello list,

I've been sitting on a formatter I wrote for Lua using LPEG. I was
hoping to generalize it (with lots of configurable options) but
haven't found much time to do so.

It's pretty easy to use:

$ lua lua-formatter.lua < f.lua > f.lua.out


Here are some main attributes of the formatted code:

o 2 space indent
o forced spaces between some keywords/equal signs
o forced semicolons for statement termination (due to some statements
requiring it)
o comment line breaks are kept

Most of the above are fairly trivial to change (e.g. 2 spaces to a tab).

If anyone would like to help me make it a more formal and option-full
project (maybe other languages too), let me know.

-- 
- Patrick Donnelly

Attachment: lua-format.lua.gz
Description: GNU Zip compressed data