Removed unused constants.
This commit is contained in:
parent
4e7a1a9839
commit
531967d13b
62
pretty.lua
62
pretty.lua
|
@ -34,14 +34,6 @@ local ERROR_UNKNOWN_TYPE = [[
|
|||
We are attempting to cover all Lua features, so please report this bug, so we can improve.
|
||||
]]
|
||||
|
||||
local SINGLE_LINE_TABLE_TYPES = {
|
||||
[TABLE_TYPE.SEQUENCE] = true,
|
||||
[TABLE_TYPE.PURE_MAP] = true,
|
||||
[TABLE_TYPE.STRING_MAP] = true,
|
||||
}
|
||||
|
||||
local SINGLE_LINE_SEQ_MAX_ELEMENTS = 10
|
||||
local SINGLE_LINE_MAP_MAX_ELEMENTS = 5
|
||||
local NR_CHARS_IN_LONG_STRING = 40
|
||||
local MAX_WIDTH_FOR_SINGLE_LINE_TABLE = 38
|
||||
|
||||
|
@ -66,30 +58,6 @@ local VALUE_TYPE_SORT_ORDER = {
|
|||
['function'] = 7,
|
||||
}
|
||||
|
||||
local RESERVED_LUA_WORDS = {
|
||||
['and'] = true,
|
||||
['break'] = true,
|
||||
['do'] = true,
|
||||
['else'] = true,
|
||||
['elseif'] = true,
|
||||
['end'] = true,
|
||||
['false'] = true,
|
||||
['for'] = true,
|
||||
['function'] = true,
|
||||
['if'] = true,
|
||||
['in'] = true,
|
||||
['local'] = true,
|
||||
['nil'] = true,
|
||||
['not'] = true,
|
||||
['or'] = true,
|
||||
['repeat'] = true,
|
||||
['return'] = true,
|
||||
['then'] = true,
|
||||
['true'] = true,
|
||||
['until'] = true,
|
||||
['while'] = true,
|
||||
}
|
||||
|
||||
local CHAR_TO_STR_REPR = {}
|
||||
|
||||
do
|
||||
|
@ -119,21 +87,6 @@ local function alphanum_compare_strings (a, b)
|
|||
< tostring(b):gsub("%.?%d+", padnum)..("%3d"):format(#a)
|
||||
end
|
||||
|
||||
local function smallest_secure_longform_string_level (str)
|
||||
-- Determines the level a longform string needs to use, to avoid "code"
|
||||
-- injection. For example, if we want to use longform on the string
|
||||
-- 'Hello ]] World', we cannot use level-0 as this would result in
|
||||
-- '[[Hello ]] World]]', which could be an issue in certain applications.
|
||||
|
||||
-- Error checking
|
||||
assert(type(str) == 'string')
|
||||
|
||||
-- Do stuff
|
||||
local levels = { [1] = 1 }
|
||||
str:gsub('%]=*%]', function (m) levels[m:len()] = true end)
|
||||
return #levels - 1
|
||||
end
|
||||
|
||||
local function compare_key_value_pairs (a, b)
|
||||
-- Get types
|
||||
local type_key_a, type_key_b = type(a[1]), type(b[1])
|
||||
|
@ -192,6 +145,21 @@ local function fill_holes_in_key_value_pairs (key_value_pairs)
|
|||
table.sort(key_value_pairs, compare_key_value_pairs)
|
||||
end
|
||||
|
||||
local function smallest_secure_longform_string_level (str)
|
||||
-- Determines the level a longform string needs to use, to avoid "code"
|
||||
-- injection. For example, if we want to use longform on the string
|
||||
-- 'Hello ]] World', we cannot use level-0 as this would result in
|
||||
-- '[[Hello ]] World]]', which could be an issue in certain applications.
|
||||
|
||||
-- Error checking
|
||||
assert(type(str) == 'string')
|
||||
|
||||
-- Do stuff
|
||||
local levels = { [1] = 1 }
|
||||
str:gsub('%]=*%]', function (m) levels[m:len()] = true end)
|
||||
return #levels - 1
|
||||
end
|
||||
|
||||
local function escape_string (str)
|
||||
|
||||
-- Error checking
|
||||
|
|
Loading…
Reference in New Issue
Block a user