From 8a05c54202f3f5792bbd7146007c6718049fecd9 Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 27 May 2007 16:18:33 -0400 Subject: [PATCH] add new regression tests: lifts, epsilon conjunct darcs-hash:20070527201833-5007d-0665414b3f03f123189c2b5847883cd7052b0c11.gz --- tests/regression.tc | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/tests/regression.tc b/tests/regression.tc index 4b1b397..80b83c8 100644 --- a/tests/regression.tc +++ b/tests/regression.tc @@ -208,7 +208,7 @@ testcase "a+b-d*c" { idl = [a-d] } -testcase "a+b*c" { +testcase "priority" { input "a+b*c"; output "plus:{stringify:{a} times:{stringify:{b} stringify:{c}}}"; w = " " @@ -225,6 +225,23 @@ testcase "a+b*c" { idl = [a-d] } +testcase "associativity" { + input "a*b*c"; + output "times:{stringify:{a} times:{stringify:{b} stringify:{c}}}"; + w = " " + l = id + s = assign:: l "=" r + | r + r = l + | assign:: l "=" r + | plus:: r "+" r + | times:: r "*" (r) + | "(" r ")" + | times:: r r + id = stringify:: idl++ + idl = [a-d] +} + testcase "unnamed" { input "aa bb"; output "{q:{a a} q:{b b}}"; @@ -413,3 +430,27 @@ testcase "operator: ~~" { B:: = ~~(... "bbb" ...) C:: = [ab]* } + +testcase "lifts" { + input "a+(b*c)"; + output "+:{a *:{id:{b} c}}"; + + s = r + r = id + | r ^"*" `r + | `r ^"+" r + | "(" r ")" + id:: = [a-z]++ +} + +testcase "epsilon as a positive conjunct" { + input "abababab"; + s:: = X* + X:: = "a" ("b"+ & ()) +} + +testcase "epsilon as a negative conjunct" { + input "aaaaa"; + s:: = X* + X:: = "a" ("b"* &~ ()) +} -- 1.7.10.4