[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: A Lua formatter with LPEG
- From: Patrick Donnelly <batrick@...>
- Date: Sat, 28 Apr 2012 22:20:26 -0400
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