summaryrefslogtreecommitdiff
path: root/test/btscan1.lm
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2014-02-01 19:49:33 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2014-02-01 19:49:33 +0000
commit404ae0f284a3b2d41fcdb53826550e4dfec5c65c (patch)
treecc446af26234e4465b8cc168b720ec44816ff5ab /test/btscan1.lm
downloadcolm-tarball-404ae0f284a3b2d41fcdb53826550e4dfec5c65c.tar.gz
Diffstat (limited to 'test/btscan1.lm')
-rw-r--r--test/btscan1.lm47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/btscan1.lm b/test/btscan1.lm
new file mode 100644
index 0000000..558b890
--- /dev/null
+++ b/test/btscan1.lm
@@ -0,0 +1,47 @@
+##### LM #####
+#
+# R1
+#
+namespace r1
+
+ lex
+ literal `! `a `b
+ ignore /[ \n\t]+/
+ end
+
+ def line [ `! `a `b `b `a]
+
+end # r1
+
+#
+# R2
+#
+namespace r2
+
+ lex
+ literal `!
+ token id /[a-zA-Z_]+/
+ ignore /[ \n\t]+/
+ end
+
+ def line [ `! id ]
+
+end # r2
+
+def item
+ [r1::line]
+| [r2::line]
+
+def btscan
+ [item*]
+
+parse P: btscan[ stdin ]
+
+match P ~!abb !abba !aab
+print_xml(P)
+print( '\n' )
+##### IN #####
+!abb !abba !aab
+
+##### EXP #####
+<btscan><_repeat_item><item><r2::line><r2::_literal_0009>!</r2::_literal_0009><r2::id>abb</r2::id></r2::line></item><item><r1::line><r1::_literal_0001>!</r1::_literal_0001><r1::_literal_0003>a</r1::_literal_0003><r1::_literal_0005>b</r1::_literal_0005><r1::_literal_0005>b</r1::_literal_0005><r1::_literal_0003>a</r1::_literal_0003></r1::line></item><item><r2::line><r2::_literal_0009>!</r2::_literal_0009><r2::id>aab</r2::id></r2::line></item></_repeat_item></btscan>