summaryrefslogtreecommitdiff
path: root/test/btscan2.lm
diff options
context:
space:
mode:
Diffstat (limited to 'test/btscan2.lm')
-rw-r--r--test/btscan2.lm42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/btscan2.lm b/test/btscan2.lm
new file mode 100644
index 0000000..bfc77db
--- /dev/null
+++ b/test/btscan2.lm
@@ -0,0 +1,42 @@
+##### LM #####
+namespace r1
+
+ lex
+ literal `! `a `b
+ ignore /[ \n\t]+/
+ end
+
+ def line [ `! `a `b `b `a]
+
+end # r1
+
+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*]
+
+cons Parser: parser<btscan> []
+
+send Parser "!ab"
+send Parser "b "
+send Parser "!ab"
+send Parser "ba !aab\n"
+
+print_xml( Parser() )
+print( '\n' )
+##### 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>