Quantcast

Fix operator precedence error that was causing DK script issues.

Johnny C. Lam [03-30-13 - 01:52]
Fix operator precedence error that was causing DK script issues.

Ovale was incorrectly parsing:

    a + b * {c / d}
as:
    {a + b} * {c + d}

This change makes it correctly parse as:

    a + {b * {c / d}}

This error was been in Ovale since MoP was released but it takes a rather
complex script to trigger it.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@869 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleCompile.lua
diff --git a/OvaleCompile.lua b/OvaleCompile.lua
index 7cfe931..9694353 100644
--- a/OvaleCompile.lua
+++ b/OvaleCompile.lua
@@ -525,7 +525,23 @@ local function ParseCommands(text)
 		text = strgsub(text, "(%w+)%.?(%w*)%s*%((.-)%)", ParseFunction)
 		text = strgsub(text, "(%d+%.?%d*)s", ParseTime)
 		text = strgsub(text, "([^%w])(%d+%.?%d*)", ParseNumber)
+		text = strgsub(text, "{([node%d ]*)}", ParseGroup)
+		if was == text then
+			break
+		end
+	end
+
+	while true do
+		local was = text
 		text = strgsub(text, "node(%d+)%s*([%*%/%%])%s*node(%d+)", ParseOp)
+		text = strgsub(text, "{([node%d ]*)}", ParseGroup)
+		if was == text then
+			break
+		end
+	end
+
+	while true do
+		local was = text
 		text = strgsub(text, "node(%d+)%s*([%+%-])%s*node(%d+)", ParseOp)
 		text = strgsub(text, "{([node%d ]*)}", ParseGroup)
 		if was == text then