summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <adrian.thurston@esentire.com>2013-05-11 16:02:20 +0000
committerAdrian Thurston <adrian.thurston@esentire.com>2013-05-11 16:02:20 +0000
commit4894280e0df0545db4db71a3bf8ed9f7f3cafd9a (patch)
treeae9109bf8f4403fa64947190a6ad36c06d3d1238
parent1804b791b0192641c20c74b66125a4023f7bb99c (diff)
downloadcolm-4894280e0df0545db4db71a3bf8ed9f7f3cafd9a.tar.gz
new test for a rhs ref after a tree copy
-rw-r--r--test/rhsref2.lm52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/rhsref2.lm b/test/rhsref2.lm
new file mode 100644
index 00000000..50d5d661
--- /dev/null
+++ b/test/rhsref2.lm
@@ -0,0 +1,52 @@
+##### LM #####
+
+lex
+ literal '-', '=', ';', '*', '->'
+ literal 'option'
+
+ token id /[A-Za-z_][A-Za-z_0-9]*/
+
+ ignore /[ \t\r\n]+/
+end
+
+def arg_option
+ I: int
+ ['option' '-' Short: id '->' Func: id ';']
+| ['option' '-' '-' Long: id '->' Func: id ';']
+
+def arg_defs
+ [arg_option+]
+
+def input [ arg_defs ]
+
+def program
+ [Input: input]
+
+parse Input: input[stdin]
+cons P: program [ Input ]
+
+I: int = 1
+
+for AO: arg_option in P {
+ if AO.Long {
+ AO.I = I
+ I = I + 1
+ }
+}
+
+I = 1
+
+for AO: arg_option in P {
+ if AO.Short
+ print( AO.Short ' ' AO.Func '\n' )
+
+ I = I + 1
+}
+
+##### IN #####
+option -h -> help;
+option -H -> help;
+option --help -> help;
+##### EXP #####
+h help
+H help