From 437be6efb52902dcd9d8587a642495e797e4f0f5 Mon Sep 17 00:00:00 2001 From: Yorwba Date: Sat, 1 Feb 2014 22:27:48 +0100 Subject: [PATCH] Fixed lua/moon line mapping --- moonscript/compile.lua | 3 +++ moonscript/compile.moon | 1 + 2 files changed, 4 insertions(+) diff --git a/moonscript/compile.lua b/moonscript/compile.lua index 2e4ff90..379c9c9 100644 --- a/moonscript/compile.lua +++ b/moonscript/compile.lua @@ -61,6 +61,9 @@ do local _exp_0 = mtype(l) if "string" == _exp_0 or DelayedLine == _exp_0 then line_no = line_no + 1 + for _ in l:gmatch("\n") do + line_no = line_no + 1 + end out[line_no] = posmap[i] elseif Lines == _exp_0 then local _ diff --git a/moonscript/compile.moon b/moonscript/compile.moon index 3176280..9539566 100644 --- a/moonscript/compile.moon +++ b/moonscript/compile.moon @@ -44,6 +44,7 @@ class Lines switch mtype l when "string", DelayedLine line_no += 1 + line_no += 1 for _ in l\gmatch"\n" out[line_no] = posmap[i] when Lines _, line_no = l\flatten_posmap line_no, out