Version 0.6.0
- honour capital/mixed cases for ignore case - consolidate consecutive matches - database upgrade capability - case sensitivity option reversed - removed obsolete WIM handling - skip empty mapping - Deletion of mapping
This commit is contained in:
@@ -36,9 +36,9 @@ local function tPrint(val, indent, known, printFunc)
|
||||
if tSize(val) > 0 then
|
||||
for key, value in pairs(val) do
|
||||
if value == nil then
|
||||
printF(rep(" ", indent) .. plainValue(key) .. "= <nil>")
|
||||
printF(rep(" ", indent) .. plainValue(key) .. " = <nil>")
|
||||
elseif type(value) == "table" then
|
||||
printF(rep(" ", indent) .. plainValue(key) .. "= {")
|
||||
printF(rep(" ", indent) .. plainValue(key) .. " = {")
|
||||
if tSize(value) > 0 then
|
||||
if not known[value] then
|
||||
tPrint(value, indent + 4, known, printF)
|
||||
@@ -65,9 +65,9 @@ function Grichelde:SplitOnFirstMatch(text, delimPattern, start)
|
||||
if text == nil then return nil end
|
||||
local pattern = "^(.-)" .. (delimPattern or " " ) .."(.*)"
|
||||
local pos = start or 1
|
||||
self:DebugPrint("SplitOnFirstMatch : text: %s, pattern: %s, start: %d", text, pattern, start)
|
||||
self:TracePrint("SplitOnFirstMatch : text: %s, pattern: %s, start: %d", text, pattern, start)
|
||||
local _, _, left, right = find(text, pattern, pos)
|
||||
self:DebugPrint("SplitOnFirstMatch : left: %s, right: %s", left, right)
|
||||
self:TracePrint("SplitOnFirstMatch : left: %s, right: %s", left, right)
|
||||
return left or text, right
|
||||
end
|
||||
|
||||
@@ -75,9 +75,9 @@ end
|
||||
function Grichelde:SplitOnLastMatch(text, delimPattern, start)
|
||||
local pattern = "(.*)" .. (delimPattern or " ") .. "(.-)$"
|
||||
local pos = start or 1
|
||||
self:DebugPrint("SplitOnLastMatch : text: %s, pattern: %s, start: %d", text, pattern, start)
|
||||
self:TracePrint("SplitOnLastMatch : text: %s, pattern: %s, start: %d", text, pattern, start)
|
||||
local _, _, left, right = find(text, pattern, pos)
|
||||
self:DebugPrint("SplitOnLastMatch : left: %s, right: %s", left, right)
|
||||
self:TracePrint("SplitOnLastMatch : left: %s, right: %s", left, right)
|
||||
return left, right or text
|
||||
end
|
||||
|
||||
@@ -153,4 +153,39 @@ function Grichelde:DebugPrint(obj, ...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Grichelde:TracePrint(obj, ...)
|
||||
local function prefixedTracePrint(...)
|
||||
print(self.COLOR_CODES.DARKGRAY .. self.L.AddonName .. self.COLOR_CODES.CLOSE .. ":", self:Format(...))
|
||||
end
|
||||
|
||||
if (self.debug and self.trace) then
|
||||
if obj == nil then
|
||||
prefixedTracePrint("<nil>")
|
||||
else
|
||||
if type(obj) == "string" then
|
||||
local l = select("#", ...)
|
||||
if ( l == 0 or not find(obj, "%%")) then
|
||||
prefixedTracePrint(obj, ...)
|
||||
else
|
||||
-- sanitize nil values in vararg
|
||||
local packed = { ... }
|
||||
for i = 1, l do
|
||||
packed[i] = toString(packed[i]) or "nil"
|
||||
end
|
||||
|
||||
-- print("packed = ", packed)
|
||||
-- self:tPrint(packed)
|
||||
-- cannot assign unpacked to a vararg variable and print it for debug
|
||||
local fmtMsg = format(obj, unpack(packed, 1, l)) -- manually set count as unpack() stops on nil (bug with #table)
|
||||
prefixedTracePrint(fmtMsg)
|
||||
end
|
||||
elseif type(obj) == "table" then
|
||||
tPrint(obj, 0, {}, prefixedTracePrint)
|
||||
else
|
||||
prefixedTracePrint(plainValue(obj))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user