small filter extension

This commit is contained in:
Manuel Simon Hirsig
2016-07-29 17:13:09 +02:00
parent 6f406bf18f
commit 7a48979a64
+7 -3
View File
@@ -482,10 +482,14 @@ function public.query(filter_term)
polish_notation_counter = 0
tinsert(post_filters, str)
prettified:append('|cffffff00'..str..'|r')
elseif polish_notation_counter > 0 or strfind(str, '^and[2-9]?$') or strfind(str, '^or[2-9]?$') or str == 'not' then
elseif polish_notation_counter > 0
or (function(_, _, m) return m == '' or m and tonumber(m) > 2 end)(strfind(str, '^and(%d*)$'))
or (function(_, _, m) return m == '' or m and tonumber(m) > 2 end)(strfind(str, '^or(%d*)$'))
or str == 'not'
then
polish_notation_counter = polish_notation_counter == 0 and polish_notation_counter + 1 or polish_notation_counter
if strfind(str, '^and[2-9]?$') or strfind(str, '^or[2-9]?$') then
local and_match, or_match = {strfind(str, '^(and)([2-9]?)$')}, {strfind(str, '^(or)([2-9]?)$') }
if strfind(str, '^and%d*$') or strfind(str, '^or%d*$') then
local and_match, or_match = {strfind(str, '^(and)(%d*)$')}, {strfind(str, '^(or)(%d*)$') }
local op = and_match[3] or or_match[3]
local count = (tonumber(and_match[4]) or tonumber(or_match[4]) or 2) - 1
polish_notation_counter = polish_notation_counter + count