Quantcast

Added code to add all patterns to otherwise unused categories

Kevin Lyles [05-19-10 - 00:59]
Added code to add all patterns to otherwise unused categories
Filename
Regexps.lua
diff --git a/Regexps.lua b/Regexps.lua
index c43dfdf..04ebf3e 100644
--- a/Regexps.lua
+++ b/Regexps.lua
@@ -34,6 +34,27 @@ local function makePatternTables()
 			table.insert(ww_regexes[category].SingleStat, {pattern, func})
 		end
 	end
+	for _, category in pairs(patternCategories) do
+		local empty = true
+		for _ in pairs(ww_regexes[category].MultipleStat) do
+			empty = false
+			break
+		end
+		for _ in pairs(ww_regexes[category].SingleStat) do
+			empty = false
+			break
+		end
+		if empty then
+			for _, regex in ipairs(MultipleStatLines) do
+				pattern, func = unpack(regex)
+				table.insert(ww_regexes[category].MultipleStat, {pattern, func})
+			end
+			for _, regex in ipairs(SingleStatLines) do
+				pattern, func = unpack(regex)
+				table.insert(ww_regexes[category].SingleStat, {pattern, func})
+			end
+		end
+	end
 end

 function initializeParser()