summaryrefslogtreecommitdiff
path: root/test/cond1.rl
diff options
context:
space:
mode:
Diffstat (limited to 'test/cond1.rl')
-rw-r--r--test/cond1.rl68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/cond1.rl b/test/cond1.rl
new file mode 100644
index 0000000..620ea5e
--- /dev/null
+++ b/test/cond1.rl
@@ -0,0 +1,68 @@
+/*
+ * @LANG: indep
+ */
+bool i;
+bool j;
+bool k;
+%%
+
+%%{
+ machine foo;
+
+ action c1 {i}
+ action c2 {j}
+ action c3 {k}
+ action one { prints " one\n";}
+ action two { prints " two\n";}
+ action three { prints " three\n";}
+
+ action seti { if ( fc == '0' ) i = false; else i = true; }
+ action setj { if ( fc == '0' ) j = false; else j = true; }
+ action setk { if ( fc == '0' ) k = false; else k = true; }
+
+ action break {fbreak;}
+
+ one = 'a' 'b' when c1 'c' @one;
+ two = 'a'* 'b' when c2 'c' @two;
+ three = 'a'+ 'b' when c3 'c' @three;
+
+ main :=
+ [01] @seti
+ [01] @setj
+ [01] @setk
+ ( one | two | three ) '\n' @break;
+
+}%%
+
+/* _____INPUT_____
+"000abc\n"
+"100abc\n"
+"010abc\n"
+"110abc\n"
+"001abc\n"
+"101abc\n"
+"011abc\n"
+"111abc\n"
+_____INPUT_____ */
+/* _____OUTPUT_____
+FAIL
+ one
+ACCEPT
+ two
+ACCEPT
+ one
+ two
+ACCEPT
+ three
+ACCEPT
+ one
+ three
+ACCEPT
+ two
+ three
+ACCEPT
+ one
+ two
+ three
+ACCEPT
+_____OUTPUT_____ */