diff options
author | Andre Murbach Maidl <andremm@gmail.com> | 2015-10-13 16:49:58 -0300 |
---|---|---|
committer | Andre Murbach Maidl <andremm@gmail.com> | 2015-10-13 16:49:58 -0300 |
commit | 53d28a6ff2ffcd6e3779b0f0bf92b6ae39d924fe (patch) | |
tree | e1f50f8c2cb0ffd047a50c3f7a82f7864e81f753 /examples/typedlua/tlparser.lua | |
parent | 779bb8c74418d41344268525c5208f874626dcd2 (diff) | |
download | lpeglabel-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.lua | 4 |
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 | |||
226 | function tlparser.parse (subject, filename, strict, integer) | 226 | function 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 |