diff options
Diffstat (limited to 'examples/listIdRe1.lua')
-rw-r--r-- | examples/listIdRe1.lua | 8 |
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 | ||
11 | function mymatch (g, s) | 11 | function 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 |