aboutsummaryrefslogtreecommitdiff
path: root/examples/listIdRe1.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/listIdRe1.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/listIdRe1.lua')
-rw-r--r--examples/listIdRe1.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/listIdRe1.lua b/examples/listIdRe1.lua
index 3098c66..d60706a 100644
--- a/examples/listIdRe1.lua
+++ b/examples/listIdRe1.lua
@@ -9,14 +9,14 @@ local g = re.compile[[
9]] 9]]
10 10
11function mymatch (g, s) 11function mymatch (g, s)
12 local r, e, sfail = g:match(s) 12 local r, e, pos = g:match(s)
13 if not r then 13 if not r then
14 local line, col = re.calcline(s, #s - #sfail) 14 local line, col = re.calcline(s, pos)
15 local msg = "Error at line " .. line .. " (col " .. col .. ")" 15 local msg = "Error at line " .. line .. " (col " .. col .. ")"
16 if e == 1 then 16 if e == 1 then
17 return r, msg .. ": expecting an identifier before '" .. sfail .. "'" 17 return r, msg .. ": expecting an identifier before '" .. s:sub(pos) .. "'"
18 elseif e == 2 then 18 elseif e == 2 then
19 return r, msg .. ": expecting ',' before '" .. sfail .. "'" 19 return r, msg .. ": expecting ',' before '" .. s:sub(pos) .. "'"
20 else 20 else
21 return r, msg 21 return r, msg
22 end 22 end