aboutsummaryrefslogtreecommitdiff
path: root/examples/toast.lua
diff options
context:
space:
mode:
authorSérgio Queiroz <sqmedeiros@gmail.com>2017-12-29 13:51:36 -0300
committerSérgio Queiroz <sqmedeiros@gmail.com>2017-12-29 13:51:36 -0300
commit19119a91005506ec2133948f3a127e68b6e93f30 (patch)
tree9f5ff03b6ddde8454f398e01229b889b469de996 /examples/toast.lua
parent261e41117c2ec8d50b9aff1ecaaa701d2af5c211 (diff)
downloadlpeglabel-19119a91005506ec2133948f3a127e68b6e93f30.tar.gz
lpeglabel-19119a91005506ec2133948f3a127e68b6e93f30.tar.bz2
lpeglabel-19119a91005506ec2133948f3a127e68b6e93f30.zip
Updating the documentation
Diffstat (limited to 'examples/toast.lua')
-rw-r--r--examples/toast.lua16
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 @@
1local m = require'lpeglabel'
2
3local recp = m.P"oast"
4
5local 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
12print(g:match("test.")) --> 6
13print(g:match("toast.")) --> 7
14print(g:match("oast.")) --> nil 0 oast.
15print(g:match("toward.")) --> nil 0 ward.
16