aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testfarthest.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/testfarthest.lua b/testfarthest.lua
new file mode 100644
index 0000000..386cbbd
--- /dev/null
+++ b/testfarthest.lua
@@ -0,0 +1,25 @@
1local m = require 'lpeglabel'
2
3function matchPrint(p, s)
4 local r, l, sfail = p:match(s)
5 print("Input:", s)
6 print("Result:", r, l, sfail)
7end
8
9local p = m.P"a"^0 * m.P"b" + m.P"c"
10
11p:pcode()
12
13matchPrint(p, "aab")
14matchPrint(p, "ck")
15matchPrint(p, "dk")
16matchPrint(p, "aak")
17
18local p = m.P"a"^0 * m.P(1) * m.P(1) + m.P"a"^0 * m.P"c"
19
20p:pcode()
21
22matchPrint(p, "aabc")
23matchPrint(p, "aac")
24matchPrint(p, "aak")
25matchPrint(p, "x")