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 c75bb1d..fc213bc 100644 --- a/examples/listIdRe1.lua +++ b/examples/listIdRe1.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local re = require 're' | 1 | local re = require 'relabel' |
2 | 2 | ||
3 | local g = re.compile[[ | 3 | local g = re.compile[[ |
4 | S <- Id List | 4 | S <- Id List |
@@ -7,12 +7,12 @@ local g = re.compile[[ | |||
7 | ]] | 7 | ]] |
8 | 8 | ||
9 | function mymatch (g, s) | 9 | function mymatch (g, s) |
10 | local r, e = g:match(s) | 10 | local r, e, sfail = g:match(s) |
11 | if not r then | 11 | if not r then |
12 | if e == 1 then | 12 | if e == 1 then |
13 | return r, "Error: expecting an identifier" | 13 | return r, "Error: expecting an identifier before '" .. sfail .. "'" |
14 | elseif e == 2 then | 14 | elseif e == 2 then |
15 | return r, "Error: expecting ','" | 15 | return r, "Error: expecting ',' before '" .. sfail .. "'" |
16 | else | 16 | else |
17 | return r, "Error" | 17 | return r, "Error" |
18 | end | 18 | end |