aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/text.nom8
-rw-r--r--nomsu_decompiler.lua2
-rw-r--r--nomsu_decompiler.moon2
3 files changed, 10 insertions, 2 deletions
diff --git a/core/text.nom b/core/text.nom
index 86d8d45..50a0ab5 100644
--- a/core/text.nom
+++ b/core/text.nom
@@ -48,6 +48,14 @@ test:
test:
assume "\n" == (newline)
+test:
+ assume (0xDEADBEEF as hex) == "0xDEADBEEF"
+externally (%num as hex) means:
+ if (%num < 0):
+ return ("-0x%X"::formatted with (- %num))
+ ..else:
+ return ("0x%X"::formatted with %num)
+
# Text literals
%escapes = {..}
nl: "\n", newline: "\n", tab: "\t", bell: "\a", cr: "\r", "carriage return": "\r"
diff --git a/nomsu_decompiler.lua b/nomsu_decompiler.lua
index 4312f6a..9dd2316 100644
--- a/nomsu_decompiler.lua
+++ b/nomsu_decompiler.lua
@@ -392,7 +392,7 @@ tree_to_nomsu = function(tree)
if type(tree[i + 1]) == 'string' and not match(tree[i + 1], "^[ \n\t,.:;#(){}[%]]") then
interp_nomsu:parenthesize()
end
- elseif bit.type == "EscapedNomsu" or bit.type == "Block" then
+ elseif bit.type == "EscapedNomsu" or bit.type == "Block" or bit.type == "IndexChain" then
interp_nomsu:parenthesize()
end
end
diff --git a/nomsu_decompiler.moon b/nomsu_decompiler.moon
index 6053979..918779e 100644
--- a/nomsu_decompiler.moon
+++ b/nomsu_decompiler.moon
@@ -309,7 +309,7 @@ tree_to_nomsu = (tree)->
if bit.type == "Var"
if type(tree[i+1]) == 'string' and not match(tree[i+1], "^[ \n\t,.:;#(){}[%]]")
interp_nomsu\parenthesize!
- elseif bit.type == "EscapedNomsu" or bit.type == "Block"
+ elseif bit.type == "EscapedNomsu" or bit.type == "Block" or bit.type == "IndexChain"
interp_nomsu\parenthesize!
nomsu\append interp_nomsu
if interp_nomsu\is_multiline!