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

Fixed line numbers in errors for Lua 5.1/LuaJIT, hopefully finally

for some reason gmatch("[^\n]*") matches *two times* per line (one with the line, and an empty string) in Lua 5.1 and LuaJIT, but behave as expected in Lua 5.2/5.3...
This commit is contained in:
Étienne Fildadut 2019-08-23 23:16:52 +02:00
parent 7df95abc6d
commit da4ee63f3f
2 changed files with 5 additions and 4 deletions

View file

@ -11,7 +11,7 @@
#import("lib.lua-parser.parser")
local candran = {
VERSION = "0.9.0"
VERSION = "0.9.1"
}
--- Default options.
@ -248,7 +248,7 @@ function candran.messageHandler(message)
if originalFile then
local i = 0
for l in originalFile:gmatch("([^\n]*)") do
for l in originalFile:gmatch("([^\n]*)\n") do
i = i +1
if i == line then
local extSource, lineMap = l:match(".*%-%- (.-)%:(%d+)$")

View file

@ -3584,7 +3584,7 @@ return parser -- ./lib/lua-parser/parser.lua:685
end -- ./lib/lua-parser/parser.lua:685
local parser = _() or parser -- ./lib/lua-parser/parser.lua:689
package["loaded"]["lib.lua-parser.parser"] = parser or true -- ./lib/lua-parser/parser.lua:690
local candran = { ["VERSION"] = "0.9.0" } -- candran.can:14
local candran = { ["VERSION"] = "0.9.1" } -- candran.can:14
candran["default"] = { -- candran.can:18
["target"] = "lua53", -- candran.can:19
["indentation"] = "", -- candran.can:20
@ -3773,7 +3773,8 @@ end -- candran.can:245
if originalFile then -- candran.can:249
local i = 0 -- candran.can:250
for l in originalFile:gmatch("([^\
]*)") do -- candran.can:251
]*)\
") do -- candran.can:251
i = i + 1 -- candran.can:252
if i == line then -- candran.can:253
local extSource, lineMap = l:match(".*%-%- (.-)%:(%d+)$") -- candran.can:254