diff options
author | Sérgio Queiroz <sqmedeiros@gmail.com> | 2017-12-29 13:51:36 -0300 |
---|---|---|
committer | Sérgio Queiroz <sqmedeiros@gmail.com> | 2017-12-29 13:51:36 -0300 |
commit | 19119a91005506ec2133948f3a127e68b6e93f30 (patch) | |
tree | 9f5ff03b6ddde8454f398e01229b889b469de996 /examples/toast.lua | |
parent | 261e41117c2ec8d50b9aff1ecaaa701d2af5c211 (diff) | |
download | lpeglabel-19119a91005506ec2133948f3a127e68b6e93f30.tar.gz lpeglabel-19119a91005506ec2133948f3a127e68b6e93f30.tar.bz2 lpeglabel-19119a91005506ec2133948f3a127e68b6e93f30.zip |
Updating the documentation
Diffstat (limited to 'examples/toast.lua')
-rw-r--r-- | examples/toast.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/toast.lua b/examples/toast.lua new file mode 100644 index 0000000..c355642 --- /dev/null +++ b/examples/toast.lua | |||
@@ -0,0 +1,16 @@ | |||
1 | local m = require'lpeglabel' | ||
2 | |||
3 | local recp = m.P"oast" | ||
4 | |||
5 | local g = m.P{ | ||
6 | 'S', | ||
7 | S = m.V'A' * '.', | ||
8 | A = m.P't' * (m.P'est' + m.T'Err'), | ||
9 | Err = m.P'oast' | ||
10 | } | ||
11 | |||
12 | print(g:match("test.")) --> 6 | ||
13 | print(g:match("toast.")) --> 7 | ||
14 | print(g:match("oast.")) --> nil 0 oast. | ||
15 | print(g:match("toward.")) --> nil 0 ward. | ||
16 | |||