aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-06-13 14:53:47 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-06-13 14:54:08 -0700
commit282565a309aef632502a64fef0a67b0b7efcfaaa (patch)
treeff0ef6f4e065312cbed298e5b3e8f384d8563e05
parent12d52f743c47c9fcb244b3d6221a18057d0a9e48 (diff)
Fixed tree_to_nomsu to produce "blah\%x" instead of "blah\(%x)"
-rw-r--r--nomsu.lua6
-rwxr-xr-xnomsu.moon6
2 files changed, 6 insertions, 6 deletions
diff --git a/nomsu.lua b/nomsu.lua
index c552534..540fa8e 100644
--- a/nomsu.lua
+++ b/nomsu.lua
@@ -904,11 +904,11 @@ do
for _index_0 = 1, #tree do
local bit = tree[_index_0]
if type(bit) == 'string' then
- nomsu:append((gsub(gsub(bit, "\\", "\\\\"), "\n", "\\n")))
+ nomsu:append((gsub(gsub(gsub(bit, "\\", "\\\\"), "\n", "\\n"), '"', '\\"')))
else
local interp_nomsu = self:tree_to_nomsu(bit, true)
if interp_nomsu then
- if bit.type ~= "List" and bit.type ~= "Dict" and bit.type ~= "Text" then
+ if bit.type ~= "Var" and bit.type ~= "List" and bit.type ~= "Dict" and bit.type ~= "Text" then
interp_nomsu:parenthesize()
end
nomsu:append("\\", interp_nomsu)
@@ -960,7 +960,7 @@ do
else
local interp_nomsu = self:tree_to_nomsu(bit, true)
if interp_nomsu then
- if bit.type ~= "List" and bit.type ~= "Dict" and bit.type ~= "Text" then
+ if bit.type ~= "Var" and bit.type ~= "List" and bit.type ~= "Dict" and bit.type ~= "Text" then
interp_nomsu:parenthesize()
end
nomsu:append("\\", interp_nomsu)
diff --git a/nomsu.moon b/nomsu.moon
index 0bc9288..1181ae4 100755
--- a/nomsu.moon
+++ b/nomsu.moon
@@ -751,11 +751,11 @@ class NomsuCompiler
for bit in *tree
if type(bit) == 'string'
-- TODO: unescape better?
- nomsu\append (gsub(gsub(bit,"\\","\\\\"),"\n","\\n"))
+ nomsu\append (gsub(gsub(gsub(bit,"\\","\\\\"),"\n","\\n"),'"','\\"'))
else
interp_nomsu = @tree_to_nomsu(bit, true)
if interp_nomsu
- if bit.type != "List" and bit.type != "Dict" and bit.type != "Text"
+ if bit.type != "Var" and bit.type != "List" and bit.type != "Dict" and bit.type != "Text"
interp_nomsu\parenthesize!
nomsu\append "\\", interp_nomsu
else return nil
@@ -791,7 +791,7 @@ class NomsuCompiler
else
interp_nomsu = @tree_to_nomsu(bit, true)
if interp_nomsu
- if bit.type != "List" and bit.type != "Dict" and bit.type != "Text"
+ if bit.type != "Var" and bit.type != "List" and bit.type != "Dict" and bit.type != "Text"
interp_nomsu\parenthesize!
nomsu\append "\\", interp_nomsu
else