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 d60706a..ef38cfb 100644 --- a/examples/listIdRe1.lua +++ b/examples/listIdRe1.lua | |||
@@ -3,8 +3,8 @@ local re = require 'relabel' | |||
3 | local g = re.compile[[ | 3 | local g = re.compile[[ |
4 | S <- Id List | 4 | S <- Id List |
5 | List <- !. / Comma Id List | 5 | List <- !. / Comma Id List |
6 | Id <- Sp [a-z]+ / %{2} | 6 | Id <- Sp [a-z]+ / %{ErrId} |
7 | Comma <- Sp ',' / %{3} | 7 | Comma <- Sp ',' / %{ErrComma} |
8 | Sp <- %s* | 8 | Sp <- %s* |
9 | ]] | 9 | ]] |
10 | 10 | ||
@@ -13,9 +13,9 @@ function mymatch (g, s) | |||
13 | if not r then | 13 | if not r then |
14 | local line, col = re.calcline(s, pos) | 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 == 'ErrId' then |
17 | return r, msg .. ": expecting an identifier before '" .. s:sub(pos) .. "'" | 17 | return r, msg .. ": expecting an identifier before '" .. s:sub(pos) .. "'" |
18 | elseif e == 2 then | 18 | elseif e == 'ErrComma' then |
19 | return r, msg .. ": expecting ',' before '" .. s:sub(pos) .. "'" | 19 | return r, msg .. ": expecting ',' before '" .. s:sub(pos) .. "'" |
20 | else | 20 | else |
21 | return r, msg | 21 | return r, msg |