aboutsummaryrefslogtreecommitdiff
path: root/examples/typedlua/tlparser.lua
diff options
context:
space:
mode:
authorSérgio Queiroz <sqmedeiros@gmail.com>2017-12-08 10:11:50 -0300
committerSérgio Queiroz <sqmedeiros@gmail.com>2017-12-08 10:11:50 -0300
commit5ffef3da93ad53069d2510a75b11ecbb1b6e8aa7 (patch)
treee98c59a9e0aae891638eca25a25558d933fdf44f /examples/typedlua/tlparser.lua
parent030df9b4a4f4dc3a2cc5775e032f83e92d3c0097 (diff)
downloadlpeglabel-5ffef3da93ad53069d2510a75b11ecbb1b6e8aa7.tar.gz
lpeglabel-5ffef3da93ad53069d2510a75b11ecbb1b6e8aa7.tar.bz2
lpeglabel-5ffef3da93ad53069d2510a75b11ecbb1b6e8aa7.zip
Updating the examples since lpeglabel now returns an error position instead of a string and p^lab is syntatic sugar
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 a301fa6..2ede2eb 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, suffix = lpeg.match(G, subject, nil, errorinfo, strict, integer) 229 local ast, label, pos = lpeg.match(G, subject, nil, errorinfo, strict, integer)
230 if not ast then 230 if not ast then
231 local line, col = lineno(subject, string.len(subject) - string.len(suffix)) 231 local line, col = lineno(subject, pos)
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