From c9ff0ff04b2d1922bcfe5b1106b9979c29b167a2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 14 Jul 2018 14:52:28 -0700 Subject: Fixed up some edge cases with parsing and comments. --- nomsu_compiler.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'nomsu_compiler.lua') diff --git a/nomsu_compiler.lua b/nomsu_compiler.lua index 6dbe4c4..788d9a0 100644 --- a/nomsu_compiler.lua +++ b/nomsu_compiler.lua @@ -725,11 +725,13 @@ do local _accum_0 = { } local _len_0 = 1 for p, c in pairs(tree.comments or { }) do - _accum_0[_len_0] = { - comment = c, - pos = p - } - _len_0 = _len_0 + 1 + if tree.source.start <= p and p <= tree.source.stop then + _accum_0[_len_0] = { + comment = c, + pos = p + } + _len_0 = _len_0 + 1 + end end comments = _accum_0 end -- cgit v1.2.3