summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2011-12-17 21:55:11 +0000
committerAdrian Thurston <thurston@complang.org>2011-12-17 21:55:11 +0000
commit74f998987ea41022c6449543b633acc0ca5c189a (patch)
tree220da96761d3e92679bdd6ed20a022c102d581bb /test
parent0bafb0322126acb2779a115e9be885b7248d8551 (diff)
downloadcolm-74f998987ea41022c6449543b633acc0ca5c189a.tar.gz
Have the split between InputStream and SourceStream partially functional. Basic
parsing working, but not more fine-grained stream control.
Diffstat (limited to 'test')
-rw-r--r--test/accumbt2.exp0
-rw-r--r--test/accumbt2.in1
-rw-r--r--test/accumbt2.lm40
3 files changed, 41 insertions, 0 deletions
diff --git a/test/accumbt2.exp b/test/accumbt2.exp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/accumbt2.exp
diff --git a/test/accumbt2.in b/test/accumbt2.in
new file mode 100644
index 00000000..12626d93
--- /dev/null
+++ b/test/accumbt2.in
@@ -0,0 +1 @@
+a b c d e ;
diff --git a/test/accumbt2.lm b/test/accumbt2.lm
new file mode 100644
index 00000000..168517bd
--- /dev/null
+++ b/test/accumbt2.lm
@@ -0,0 +1,40 @@
+lex one
+{
+ ignore /[ \t\n]+/
+ token id1 /[a-zA-Z_][a-zA-Z_0-9]*/
+
+ def one [ id1* ]
+}
+
+global OneParser: accum<one> =
+ cons accum<one>[]
+
+lex two
+{
+ ignore /[ \t]+/
+ token id2 /[a-zA-Z_][a-zA-Z_0-9]*/
+ literal '!', ';', '\n'
+
+ def A1 []
+ { print( "A1\n" ) }
+
+ def A2 []
+ { print( "A2\n" ) }
+
+ def item2
+ [id2]
+ {
+ send OneParser [' extra ']
+ send OneParser [$r1]
+ }
+
+ def two
+ [A1 item2* '!' '\n']
+ | [A2 item2* ';' '\n']
+}
+
+Two: two =
+ parse two( stdin )
+
+print( Two )
+print( OneParser.finish() '\n' )