aboutsummaryrefslogtreecommitdiff
path: root/examples/tiny.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/tiny.lua
parent261e41117c2ec8d50b9aff1ecaaa701d2af5c211 (diff)
downloadlpeglabel-19119a91005506ec2133948f3a127e68b6e93f30.tar.gz
lpeglabel-19119a91005506ec2133948f3a127e68b6e93f30.tar.bz2
lpeglabel-19119a91005506ec2133948f3a127e68b6e93f30.zip
Updating the documentation
Diffstat (limited to 'examples/tiny.lua')
-rw-r--r--examples/tiny.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/tiny.lua b/examples/tiny.lua
index fe0bced..7548995 100644
--- a/examples/tiny.lua
+++ b/examples/tiny.lua
@@ -19,11 +19,12 @@ local terror = {
19 factor = "Error matching 'Factor'", 19 factor = "Error matching 'Factor'",
20 openParExp = "Error matching expression after '('", 20 openParExp = "Error matching expression after '('",
21 closePar = "Error matching ')'", 21 closePar = "Error matching ')'",
22 eof = "Error, expecting EOF",
22 undefined = "Undefined Error" 23 undefined = "Undefined Error"
23} 24}
24 25
25g = re.compile([[ 26g = re.compile([[
26 Tiny <- CmdSeq^undefined 27 Tiny <- CmdSeq (!. / %{eof})
27 CmdSeq <- (Cmd SEMICOLON^cmdSeq) (Cmd SEMICOLON^cmdSeq)* 28 CmdSeq <- (Cmd SEMICOLON^cmdSeq) (Cmd SEMICOLON^cmdSeq)*
28 Cmd <- IfCmd / RepeatCmd / ReadCmd / WriteCmd / AssignCmd 29 Cmd <- IfCmd / RepeatCmd / ReadCmd / WriteCmd / AssignCmd
29 IfCmd <- IF Exp^ifExp THEN^ifThen CmdSeq^ifThenCmdSeq (ELSE CmdSeq^ifElseCmdSeq / '') END^ifEnd 30 IfCmd <- IF Exp^ifExp THEN^ifThen CmdSeq^ifThenCmdSeq (ELSE CmdSeq^ifElseCmdSeq / '') END^ifEnd
@@ -118,5 +119,5 @@ repeat
118print(mymatch(g, s)) 119print(mymatch(g, s))
119 120
120print(mymatch(g, "a : 2")) 121print(mymatch(g, "a : 2"))
121print(mymatch(g, "a := (2")) 122print(mymatch(g, "a := 2; 6"))
122 123