aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Queiroz <sqmedeiros@gmail.com>2017-01-02 11:19:58 -0300
committerSergio Queiroz <sqmedeiros@gmail.com>2017-01-02 11:19:58 -0300
commit2e5820c37e4e6cb2a2c01863619abd19eb5a8199 (patch)
treec239f53708f00c9c588b95360608939f16bac4c5
parentb04d3e015ba3f7a660c90b3b75ed937491327efe (diff)
downloadlpeglabel-2e5820c37e4e6cb2a2c01863619abd19eb5a8199.tar.gz
lpeglabel-2e5820c37e4e6cb2a2c01863619abd19eb5a8199.tar.bz2
lpeglabel-2e5820c37e4e6cb2a2c01863619abd19eb5a8199.zip
Adding tests to check farthest fail
-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")