diff options
author | Sergio Queiroz <sqmedeiros@gmail.com> | 2016-11-14 17:15:27 -0300 |
---|---|---|
committer | Sergio Queiroz <sqmedeiros@gmail.com> | 2016-11-14 17:15:27 -0300 |
commit | 448762908fd822fbc101a4fe66fac9cd8aa913b5 (patch) | |
tree | c7bc865aa66f557be6d3d9d422bcaec42a8be0be /examples/listId2.lua | |
parent | fd28f9d9e54f33bf7ae3a5e12dc71478f9c91aea (diff) | |
download | lpeglabel-448762908fd822fbc101a4fe66fac9cd8aa913b5.tar.gz lpeglabel-448762908fd822fbc101a4fe66fac9cd8aa913b5.tar.bz2 lpeglabel-448762908fd822fbc101a4fe66fac9cd8aa913b5.zip |
Changing documentation and examples with recovery
Diffstat (limited to 'examples/listId2.lua')
-rw-r--r-- | examples/listId2.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/listId2.lua b/examples/listId2.lua index 509fda4..46f0063 100644 --- a/examples/listId2.lua +++ b/examples/listId2.lua | |||
@@ -1,5 +1,5 @@ | |||
1 | local m = require'lpeglabel' | 1 | local m = require'lpeglabelrec' |
2 | local re = require'relabel' | 2 | local re = require'relabelrec' |
3 | 3 | ||
4 | local terror = {} | 4 | local terror = {} |
5 | 5 | ||
@@ -12,15 +12,18 @@ local errUndef = newError("undefined") | |||
12 | local errId = newError("expecting an identifier") | 12 | local errId = newError("expecting an identifier") |
13 | local errComma = newError("expecting ','") | 13 | local errComma = newError("expecting ','") |
14 | 14 | ||
15 | local id = m.R'az'^1 | ||
16 | |||
15 | local g = m.P{ | 17 | local g = m.P{ |
16 | "S", | 18 | "S", |
17 | S = m.V"Id" * m.V"List", | 19 | S = m.V"Id" * m.V"List", |
18 | List = -m.P(1) + (m.V"Comma" + m.T(errComma)) * (m.V"Id" + m.T(errId)) * m.V"List", | 20 | List = -m.P(1) + m.V"Comma" * m.V"Id" * m.V"List", |
19 | Id = m.V"Sp" * m.R'az'^1, | 21 | Id = m.V"Sp" * id + m.T(errId), |
20 | Comma = m.V"Sp" * ",", | 22 | Comma = m.V"Sp" * "," + m.T(errComma), |
21 | Sp = m.S" \n\t"^0, | 23 | Sp = m.S" \n\t"^0, |
22 | } | 24 | } |
23 | 25 | ||
26 | |||
24 | function mymatch (g, s) | 27 | function mymatch (g, s) |
25 | local r, e, sfail = g:match(s) | 28 | local r, e, sfail = g:match(s) |
26 | if not r then | 29 | if not r then |