diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/listId2.lua | 4 | ||||
-rw-r--r-- | examples/listIdCatchRe.lua | 2 | ||||
-rw-r--r-- | examples/listIdRe1.lua | 8 | ||||
-rw-r--r-- | examples/listIdRe2.lua | 6 | ||||
-rw-r--r-- | examples/tiny.lua | 2 |
5 files changed, 11 insertions, 11 deletions
diff --git a/examples/listId2.lua b/examples/listId2.lua index 4943368..75060f9 100644 --- a/examples/listId2.lua +++ b/examples/listId2.lua | |||
@@ -18,9 +18,9 @@ local g = m.P{ | |||
18 | } | 18 | } |
19 | 19 | ||
20 | function mymatch (g, s) | 20 | function mymatch (g, s) |
21 | local r, e = g:match(s) | 21 | local r, e, sfail = g:match(s) |
22 | if not r then | 22 | if not r then |
23 | return r, terror[e] | 23 | return r, terror[e] .. " before '" .. sfail .. "'" |
24 | end | 24 | end |
25 | return r | 25 | return r |
26 | end | 26 | end |
diff --git a/examples/listIdCatchRe.lua b/examples/listIdCatchRe.lua index 5d38fec..8971191 100644 --- a/examples/listIdCatchRe.lua +++ b/examples/listIdCatchRe.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local re = require're' | 1 | local re = require'relabel' |
2 | 2 | ||
3 | local terror = {} | 3 | local terror = {} |
4 | 4 | ||
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 |
diff --git a/examples/listIdRe2.lua b/examples/listIdRe2.lua index 67c42f1..4cd140b 100644 --- a/examples/listIdRe2.lua +++ b/examples/listIdRe2.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local re = require 're' | 1 | local re = require 'relabel' |
2 | 2 | ||
3 | local errUndef, errId, errComma = 0, 1, 2 | 3 | local errUndef, errId, errComma = 0, 1, 2 |
4 | 4 | ||
@@ -21,9 +21,9 @@ local g = re.compile[[ | |||
21 | ]] | 21 | ]] |
22 | 22 | ||
23 | function mymatch (g, s) | 23 | function mymatch (g, s) |
24 | local r, e = g:match(s) | 24 | local r, e, sfail = g:match(s) |
25 | if not r then | 25 | if not r then |
26 | return r, terror[e] | 26 | return r, terror[e] .. " before '" .. sfail .. "'" |
27 | end | 27 | end |
28 | return r | 28 | return r |
29 | end | 29 | end |
diff --git a/examples/tiny.lua b/examples/tiny.lua index aa9dbea..99c3144 100644 --- a/examples/tiny.lua +++ b/examples/tiny.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local re = require 're' | 1 | local re = require 'relabel' |
2 | 2 | ||
3 | local terror = {} | 3 | local terror = {} |
4 | 4 | ||