Module:Sandbox/Hellknowz/Test: Difference between revisions

Content deleted Content added
m 6
add and some comments
Line 250:
]]
 
-- Now comes an uber-deep if-then-else tree
-- This is roughly the most efficient step-by-step parsing, something like log(N)
-- Doing each combination via pattern/"Regex" is way slower
-- Having each combination a clean function/preset means checking every element, so way slower
-- Only immediate big improvement is to only seekNextElement() when actually checking that deep, though this will make a (even bigger) mess
 
if (elements[1] == ELEMENT_ONETWODIGITS) then -- '3' or '10'
Line 294 ⟶ 299:
if (elements[11] == ELEMENT_FOURDIGITS) then -- '10:28:27, 3 May 2013'
if (numberOfElements == 11) then return checkAndOutput(values[11], values[9], values[7], values[1], values[3], values[5]) end
end
end
end
end
elseif (elements[7] == ELEMENT_MONTHWORD) then -- '10:28:27, May'
if (elements[8] == ELEMENT_WHITESPACE) then -- '10:28:27, May '
if (elements[9] == ELEMENT_ONETWODIGITS) then -- '10:28:27, May 3'
if (elements[10] == ELEMENT_COMMA or elements[10] == ELEMENT_WHITESPACE) then -- '10:28:27, May 3, '
if (elements[11] == ELEMENT_FOURDIGITS) then -- '10:28:27, May 3, 2013'
if (numberOfElements == 11) then return checkAndOutput(values[11], values[7], values[9], values[1], values[3], values[5]) end
end
end
end
end
elseif (elements[7] == ELEMENT_FOURDIGITS) then -- '10:28:27, 2013'
if (elements[8] == ELEMENT_DATESEPARATOR) then -- '10:28:27, 2013-'
if (elements[9] == ELEMENT_ONETWODIGITS) then -- '10:28:27, 2013-05'
if (elements[10] == ELEMENT_DATESEPARATOR) then -- '10:28:27, 2013-05-'
if (elements[11] == ELEMENT_FOURDIGITS) then -- '10:28:27, 2013-05-03'
if (numberOfElements == 11) then return checkAndOutput(values[7], values[9], values[11], values[1], values[3], values[5]) end
end
end