diff options
author | Sérgio Queiroz <sqmedeiros@gmail.com> | 2017-12-08 10:11:50 -0300 |
---|---|---|
committer | Sérgio Queiroz <sqmedeiros@gmail.com> | 2017-12-08 10:11:50 -0300 |
commit | 5ffef3da93ad53069d2510a75b11ecbb1b6e8aa7 (patch) | |
tree | e98c59a9e0aae891638eca25a25558d933fdf44f /examples/listId2.lua | |
parent | 030df9b4a4f4dc3a2cc5775e032f83e92d3c0097 (diff) | |
download | lpeglabel-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/listId2.lua')
-rw-r--r-- | examples/listId2.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/listId2.lua b/examples/listId2.lua index 3ee89da..592dae3 100644 --- a/examples/listId2.lua +++ b/examples/listId2.lua | |||
@@ -25,11 +25,11 @@ local g = m.P{ | |||
25 | 25 | ||
26 | 26 | ||
27 | function mymatch (g, s) | 27 | function mymatch (g, s) |
28 | local r, e, sfail = g:match(s) | 28 | local r, e, pos = g:match(s) |
29 | if not r then | 29 | if not r then |
30 | local line, col = re.calcline(s, #s - #sfail) | 30 | local line, col = re.calcline(s, pos) |
31 | local msg = "Error at line " .. line .. " (col " .. col .. "): " | 31 | local msg = "Error at line " .. line .. " (col " .. col .. "): " |
32 | return r, msg .. terror[e] .. " before '" .. sfail .. "'" | 32 | return r, msg .. terror[e] .. " before '" .. s:sub(pos) .. "'" |
33 | end | 33 | end |
34 | return r | 34 | return r |
35 | end | 35 | end |