aboutsummaryrefslogtreecommitdiff
path: root/examples/listIdRe1.lua
diff options
context:
space:
mode:
authorSergio Queiroz <sqmedeiros@gmail.com>2016-06-13 11:56:47 -0300
committerSergio Queiroz <sqmedeiros@gmail.com>2016-06-13 11:56:47 -0300
commit43ce0cb6027033a9a08075d72a77630720895834 (patch)
tree181d3e2ac0c054802f5de35d82f8dd3beeadfe8f /examples/listIdRe1.lua
parentd6b07c6c87655aa114af6aae8b6fef241f99aca3 (diff)
downloadlpeglabel-43ce0cb6027033a9a08075d72a77630720895834.tar.gz
lpeglabel-43ce0cb6027033a9a08075d72a77630720895834.tar.bz2
lpeglabel-43ce0cb6027033a9a08075d72a77630720895834.zip
Updating examples and documentation to match the new API
Diffstat (limited to 'examples/listIdRe1.lua')
-rw-r--r--examples/listIdRe1.lua8
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 @@
1local re = require 're' 1local re = require 'relabel'
2 2
3local g = re.compile[[ 3local g = re.compile[[
4 S <- Id List 4 S <- Id List
@@ -7,12 +7,12 @@ local g = re.compile[[
7]] 7]]
8 8
9function mymatch (g, s) 9function 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