From 53d28a6ff2ffcd6e3779b0f0bf92b6ae39d924fe Mon Sep 17 00:00:00 2001 From: Andre Murbach Maidl Date: Tue, 13 Oct 2015 16:49:58 -0300 Subject: Fixing Typed Lua parser to use label failure position instead of farthest failure position --- examples/typedlua/tlparser.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/typedlua/tlparser.lua') diff --git a/examples/typedlua/tlparser.lua b/examples/typedlua/tlparser.lua index dba94f7..a301fa6 100644 --- a/examples/typedlua/tlparser.lua +++ b/examples/typedlua/tlparser.lua @@ -226,9 +226,9 @@ end function tlparser.parse (subject, filename, strict, integer) local errorinfo = {} lpeg.setmaxstack(1000) - local ast, label, _ = lpeg.match(G, subject, nil, errorinfo, strict, integer) + local ast, label, suffix = lpeg.match(G, subject, nil, errorinfo, strict, integer) if not ast then - local line, col = lineno(subject, errorinfo.ffp) + local line, col = lineno(subject, string.len(subject) - string.len(suffix)) local error_msg = string.format("%s:%d:%d: ", filename, line, col) if label ~= 0 then error_msg = error_msg .. tlerror.errors[label].msg -- cgit v1.2.3-55-g6feb