aboutsummaryrefslogtreecommitdiff
path: root/nomsu_compiler.moon
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-09-14 15:24:24 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-09-14 15:24:31 -0700
commit7112af7cb6ee52f4ef9664db9c03db52d8c73ac9 (patch)
tree9d0218229db4ab396286638958353ce523ee3985 /nomsu_compiler.moon
parent626b6cab7988e26766ba64178dd67e4093494552 (diff)
Fixed comments in nomsu codegen.
Diffstat (limited to 'nomsu_compiler.moon')
-rw-r--r--nomsu_compiler.moon6
1 files changed, 3 insertions, 3 deletions
diff --git a/nomsu_compiler.moon b/nomsu_compiler.moon
index b5168a5..b6faba3 100644
--- a/nomsu_compiler.moon
+++ b/nomsu_compiler.moon
@@ -672,13 +672,13 @@ with NomsuCompiler
find_comments(tree)
-- Sort in reversed order so they can be easily popped
comments = [c for c in pairs comment_set]
- table.sort(comments, (a,b)->(a.pos > b.pos))
+ table.sort(comments, (a,b)->(a.source.start > b.source.start))
pop_comments = (pos, prefix='', suffix='')->
nomsu = NomsuCode(tree.source)
for i=#comments,1,-1
- break if comments[i].pos > pos
- comment, comments[i] = comments[i].comment, nil
+ break if comments[i].source.start > pos
+ comment, comments[i] = comments[i][1], nil
nomsu\append("#"..(gsub(comment, "\n", "\n ")).."\n")
if comment\match("^\n.") then nomsu\append("\n") -- for aesthetics
return '' if #nomsu.bits == 0