aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/operators.nom5
-rw-r--r--nomsu_tree.lua4
-rw-r--r--nomsu_tree.moon3
3 files changed, 5 insertions, 7 deletions
diff --git a/core/operators.nom b/core/operators.nom
index 480a75f..6ec6909 100644
--- a/core/operators.nom
+++ b/core/operators.nom
@@ -132,11 +132,6 @@ immediately
immediately
# Math Operators
- compile [%x + %y] to: Lua value "(\(%x as lua expr) + \(%y as lua expr))"
- compile [%x - %y] to: Lua value "(\(%x as lua expr) - \(%y as lua expr))"
- compile [%x * %y] to: Lua value "(\(%x as lua expr) * \(%y as lua expr))"
- compile [%x / %y] to: Lua value "(\(%x as lua expr) / \(%y as lua expr))"
- compile [%x ^ %y] to: Lua value "(\(%x as lua expr) ^ \(%y as lua expr))"
compile [%x wrapped around %y, %x mod %y] to: Lua value "(\(%x as lua expr) % \(%y as lua expr))"
# 3-part chained comparisons
diff --git a/nomsu_tree.lua b/nomsu_tree.lua
index 817c325..92871e5 100644
--- a/nomsu_tree.lua
+++ b/nomsu_tree.lua
@@ -203,13 +203,15 @@ Tree("Action", {
local src = tok.source:get_text()
error("non-expression value inside math expression: " .. tostring(colored.yellow(src)))
end
+ if tok.type == "Action" then
+ tok_lua:parenthesize()
+ end
lua:append(tok_lua)
end
if i < #self.value then
lua:append(" ")
end
end
- lua:parenthesize()
return lua
end
local args = { }
diff --git a/nomsu_tree.moon b/nomsu_tree.moon
index 0119490..4af4dfc 100644
--- a/nomsu_tree.moon
+++ b/nomsu_tree.moon
@@ -132,10 +132,11 @@ Tree "Action",
unless tok_lua.is_value
src = tok.source\get_text!
error("non-expression value inside math expression: #{colored.yellow src}")
+ if tok.type == "Action"
+ tok_lua\parenthesize!
lua\append tok_lua
if i < #@value
lua\append " "
- lua\parenthesize!
return lua
args = {}