1
0
Fork 0
mirror of https://github.com/Reuh/candran.git synced 2025-10-27 09:59:29 +00:00

don't add line mappin comments ad infinitum

This commit is contained in:
Étienne Fildadut 2017-08-23 19:22:18 +02:00
parent c0f7934d92
commit 9b809fc8a4
2 changed files with 11 additions and 5 deletions

View file

@ -1922,14 +1922,17 @@ for line in (input .. "\
i = i + 1
if line:match("^%s*#") and not line:match("^#!") then
preprocessor = preprocessor .. line:gsub("^%s*#", "")
elseif options["mapLines"] then
preprocessor = preprocessor .. ("write(%q)"):format(line:sub(1, - 2) .. " -- " .. options["chunkname"] .. ":" .. i) .. "\
else
local l = line:sub(1, - 2)
if options["mapLines"] and not l:match("%-%- (.-)%:(%d+)$") then
preprocessor = preprocessor .. ("write(%q)"):format(l .. " -- " .. options["chunkname"] .. ":" .. i) .. "\
"
else
preprocessor = preprocessor .. ("write(%q)"):format(line:sub(1, - 2)) .. "\
"
end
end
end
preprocessor = preprocessor .. "return output"
local env = util["merge"](_G, options)
env["candran"] = candran