Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CommandLineBeautify.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
-- A command line utility for beautifying lua source code using the beautifier.
--

local util = require'Util'
local Parser = require'ParseLua'
local Format_Beautify = require'FormatBeautiful'
local ParseLua = Parser.ParseLua
local PrintTable = util.PrintTable

local function splitFilename(name)
--table.foreach(arg, print)
Expand Down
2 changes: 0 additions & 2 deletions CommandLineMinify.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
-- A command line utility for minifying lua source code using the minifier.
--

local util = require'Util'
local Parser = require'ParseLua'
local Format_Mini = require'FormatMini'
local ParseLua = Parser.ParseLua
local PrintTable = util.PrintTable

local function splitFilename(name)
table.foreach(arg, print)
Expand Down
4 changes: 1 addition & 3 deletions FormatBeautiful.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
-- Returns a beautified version of the code, including comments
--

local parser = require"ParseLua"
local ParseLua = parser.ParseLua
local util = require'Util'
local lookupify = util.lookupify
local lookupify = util.Lookupify

local LowerChars = lookupify{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
Expand Down
26 changes: 13 additions & 13 deletions FormatIdentity.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
require'strict'
require'ParseLua'
local util = require'Util'

local function debug_printf(...)
--[[
util.printf(...)
--]]
end

--
-- FormatIdentity.lua
--
Expand All @@ -17,6 +7,16 @@ end
-- an AST.
--

require'strict'

local util = require'Util'

local function debug_printf(...)
--[[
util.Printf(...)
--]]
end

local function Format_Identity(ast)
local out = {
rope = {}, -- List of strings
Expand All @@ -26,7 +26,7 @@ local function Format_Identity(ast)
appendStr = function(self, str)
table.insert(self.rope, str)

local lines = util.splitLines(str)
local lines = util.SplitLines(str)
if #lines == 1 then
self.char = self.char + #str
else
Expand All @@ -41,7 +41,7 @@ local function Format_Identity(ast)
--[*[
--debug_printf("appendToken(%q)", token.Data)
local data = token.Data
local lines = util.splitLines(data)
local lines = util.SplitLines(data)
while self.line + #lines < token.Line do
print("Inserting extra line")
self.str = self.str .. '\n'
Expand Down Expand Up @@ -100,7 +100,7 @@ local function Format_Identity(ast)
local function appendComma(mandatory, seperators)
if true then
seperators = seperators or { "," }
seperators = util.lookupify( seperators )
seperators = util.Lookupify( seperators )
if not mandatory and not seperators[peek()] then
return
end
Expand Down
9 changes: 3 additions & 6 deletions FormatMini.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@

local parser = require'ParseLua'
local ParseLua = parser.ParseLua
local util = require'Util'
local lookupify = util.lookupify

--
-- FormatMini.lua
--
Expand All @@ -12,6 +6,9 @@ local lookupify = util.lookupify
-- - All local variables are renamed
--

local util = require'Util'
local lookupify = util.Lookupify

local LowerChars = lookupify{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}
Expand Down
4 changes: 1 addition & 3 deletions ParseLua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
require'strict'

local util = require'Util'
local lookupify = util.lookupify
local lookupify = util.Lookupify

local WhiteChars = lookupify{' ', '\n', '\t', '\r'}
local EscapeLookup = {['\r'] = '\\r', ['\n'] = '\\n', ['\t'] = '\\t', ['"'] = '\\"', ["'"] = "\\'"}
local LowerChars = lookupify{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}
Expand Down
Loading