aboutsummaryrefslogtreecommitdiff
path: root/nomsu_compiler.moon
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-09-10 16:26:08 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-09-10 16:26:27 -0700
commit7c6047254e5aa7ce5a0667b14676b22a7447f956 (patch)
treef98478e6c77257610e43dc45447cd23e91bdaaae /nomsu_compiler.moon
parentc859eac2beb20889e162ca28f889cc02ac592266 (diff)
Upgraded to 3.8 (text method changes) and fixed some bugs in
tree_to_nomsu.
Diffstat (limited to 'nomsu_compiler.moon')
-rw-r--r--nomsu_compiler.moon10
1 files changed, 8 insertions, 2 deletions
diff --git a/nomsu_compiler.moon b/nomsu_compiler.moon
index 7a637f4..ba911ce 100644
--- a/nomsu_compiler.moon
+++ b/nomsu_compiler.moon
@@ -621,7 +621,10 @@ with NomsuCompiler
if type(pos) != 'number' then pos = #tostring(pos)\match("[ ]*([^\n]*)$")
space = MAX_LINE - pos
local inline
- for prefix, nomsu, tree in coroutine.wrap(-> inline = @tree_to_inline_nomsu(t, false, coroutine.yield))
+ check = (prefix,nomsu,tree)->
+ if type(tree) == 'number' then require('ldt').breakpoint!
+ coroutine.yield(prefix,nomsu,tree)
+ for prefix, nomsu, tree in coroutine.wrap(-> inline = @tree_to_inline_nomsu(t, false, check))
len = #tostring(nomsu)
break if prefix+len > MAX_LINE
break if tree.type == "Block" and (#tree > 1 or len > 20)
@@ -700,7 +703,10 @@ with NomsuCompiler
return nomsu
when "EscapedNomsu"
- return NomsuCode tree.source, "\\", recurse(tree[1], 1)
+ val_nomsu = recurse(tree[1], 1)
+ if tree[1].type == "Action" and not val_nomsu\is_multiline!
+ val_nomsu\parenthesize!
+ return NomsuCode tree.source, "\\", val_nomsu
when "Block"
nomsu = NomsuCode(tree.source, pop_comments(tree.source.start))