summaryrefslogtreecommitdiff
path: root/test/accum3.lm
diff options
context:
space:
mode:
Diffstat (limited to 'test/accum3.lm')
-rw-r--r--test/accum3.lm36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/accum3.lm b/test/accum3.lm
new file mode 100644
index 0000000..956bb3f
--- /dev/null
+++ b/test/accum3.lm
@@ -0,0 +1,36 @@
+##### LM #####
+lex
+ literal `-
+ token file /^('-'|0)(^0)*/
+end
+
+token word /(^0)+/
+token zero /0/
+
+lex
+ token single /[qvh]/
+ token with_opt /[oi]/
+end
+
+def item
+ [file zero]
+| [`- single* zero]
+| [`- with_opt zero? word zero]
+
+def args
+ [word zero item*]
+
+cons ArgParser: parser<args> []
+
+ArgV: list<str> ArgV = argv
+for A: str in ArgV
+ send ArgParser [A '\0']
+
+Args: args = ArgParser()
+
+print_xml( Args )
+print( '\n' )
+##### ARGS #####
+-qv -h -o output sdf -i eth0 file
+##### EXP #####
+<args><word>./working/accum3</word><zero>&#0;</zero><_repeat_item><item><_literal_0001>-</_literal_0001><_repeat_single><single>q</single><single>v</single></_repeat_single><zero>&#0;</zero></item><item><_literal_0001>-</_literal_0001><_repeat_single><single>h</single></_repeat_single><zero>&#0;</zero></item><item><_literal_0001>-</_literal_0001><with_opt>o</with_opt><_opt_zero><zero>&#0;</zero></_opt_zero><word>output</word><zero>&#0;</zero></item><item><file>sdf</file><zero>&#0;</zero></item><item><_literal_0001>-</_literal_0001><with_opt>i</with_opt><_opt_zero><zero>&#0;</zero></_opt_zero><word>eth0</word><zero>&#0;</zero></item><item><file>file</file><zero>&#0;</zero></item></_repeat_item></args>