summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2010-01-31 21:30:13 +0000
committerAdrian Thurston <thurston@complang.org>2010-01-31 21:30:13 +0000
commit54d14bc975937328c43fb4dad9fd8b0c329fe1e7 (patch)
treebcfdff3051e0ec484e9b92cdf9c1e5f49cc3d998 /test
parentaddf9105a8f531a1bb7ee170e57969f67649f0e2 (diff)
downloadcolm-54d14bc975937328c43fb4dad9fd8b0c329fe1e7.tar.gz
Context test.
Diffstat (limited to 'test')
-rw-r--r--test/context1.exp2
-rw-r--r--test/context1.in1
-rw-r--r--test/context1.lm33
-rwxr-xr-xtest/runtests2
4 files changed, 37 insertions, 1 deletions
diff --git a/test/context1.exp b/test/context1.exp
new file mode 100644
index 00000000..03c53bf2
--- /dev/null
+++ b/test/context1.exp
@@ -0,0 +1,2 @@
+2
+a b c ( d e f )
diff --git a/test/context1.in b/test/context1.in
new file mode 100644
index 00000000..3130281a
--- /dev/null
+++ b/test/context1.in
@@ -0,0 +1 @@
+a b c ( d e f )
diff --git a/test/context1.lm b/test/context1.lm
new file mode 100644
index 00000000..2fe37eaf
--- /dev/null
+++ b/test/context1.lm
@@ -0,0 +1,33 @@
+context ctx
+{
+ int i
+ int j
+ int k
+
+ lex start
+ {
+ ignore /space+/
+ literal '*', '(', ')'
+ token id /[a-zA-Z_]+/
+ }
+
+ def foo [id]
+
+ def item
+ [id]
+ | [foo]
+ | ['(' item* ')']
+ {
+ i = 0
+ j = i + 1
+ k = j + 1
+ print( k, '\n' )
+ }
+
+ def start
+ [item*]
+}
+
+ctx CTX = cons ctx[]
+start Input = parse start( CTX, stdin )
+print( Input, '\n' )
diff --git a/test/runtests b/test/runtests
index 2f806a40..f270de7c 100755
--- a/test/runtests
+++ b/test/runtests
@@ -6,7 +6,7 @@ TESTS="
backtrack1.lm backtrack2.lm dns.lm accum.lm
mutualrec.lm argv1.lm argv2.lm exit.lm rubyhere.lm
translate1.lm construct1.lm construct2.lm construct3.lm
- treecmp1.lm
+ treecmp1.lm context1.lm
"
for t in $TESTS; do