From 4e23e2d65e013077d200e85dbd85326909515bf6 Mon Sep 17 00:00:00 2001 From: Undecidable Robot Date: Sat, 21 May 2016 23:34:05 +0800 Subject: Fixing minor memory leak in error reporting --- relabel.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/relabel.lua b/relabel.lua index f849b58..5fa0db6 100644 --- a/relabel.lua +++ b/relabel.lua @@ -80,7 +80,7 @@ for i, err in ipairs(errinfo) do labels[err[1]] = i end -local errfound +local errfound = {} local function expect(pattern, labelname) local label = labels[labelname] @@ -328,7 +328,6 @@ end local function compile (p, defs) if mm.type(p) == "pattern" then return p end -- already compiled p = p .. " " -- for better reporting of column numbers in errors when at EOF - errfound = {} local cp, label, suffix = pattern:match(p, 1, defs) if #errfound > 0 then local lines = {} @@ -344,6 +343,7 @@ local function compile (p, defs) tinsert(errors, rep(" ", col-1) .. "^") end end + errfound = {} error(concat(errors, "\n")) end return cp -- cgit v1.2.3-55-g6feb