aboutsummaryrefslogtreecommitdiff
path: root/examples/typedlua/tlparser.lua
diff options
context:
space:
mode:
authorAndre Murbach Maidl <andremm@gmail.com>2015-10-13 16:49:58 -0300
committerAndre Murbach Maidl <andremm@gmail.com>2015-10-13 16:49:58 -0300
commit53d28a6ff2ffcd6e3779b0f0bf92b6ae39d924fe (patch)
treee1f50f8c2cb0ffd047a50c3f7a82f7864e81f753 /examples/typedlua/tlparser.lua
parent779bb8c74418d41344268525c5208f874626dcd2 (diff)
downloadlpeglabel-typedlua.tar.gz
lpeglabel-typedlua.tar.bz2
lpeglabel-typedlua.zip
Fixing Typed Lua parser to use label failure position instead of farthest failure positiontypedlua
Diffstat (limited to 'examples/typedlua/tlparser.lua')
-rw-r--r--examples/typedlua/tlparser.lua4
1 files changed, 2 insertions, 2 deletions
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
226function tlparser.parse (subject, filename, strict, integer) 226function tlparser.parse (subject, filename, strict, integer)
227 local errorinfo = {} 227 local errorinfo = {}
228 lpeg.setmaxstack(1000) 228 lpeg.setmaxstack(1000)
229 local ast, label, _ = lpeg.match(G, subject, nil, errorinfo, strict, integer) 229 local ast, label, suffix = lpeg.match(G, subject, nil, errorinfo, strict, integer)
230 if not ast then 230 if not ast then
231 local line, col = lineno(subject, errorinfo.ffp) 231 local line, col = lineno(subject, string.len(subject) - string.len(suffix))
232 local error_msg = string.format("%s:%d:%d: ", filename, line, col) 232 local error_msg = string.format("%s:%d:%d: ", filename, line, col)
233 if label ~= 0 then 233 if label ~= 0 then
234 error_msg = error_msg .. tlerror.errors[label].msg 234 error_msg = error_msg .. tlerror.errors[label].msg