summaryrefslogtreecommitdiff
path: root/test/trans.d/case/scan3_ocaml.rl
diff options
context:
space:
mode:
Diffstat (limited to 'test/trans.d/case/scan3_ocaml.rl')
-rw-r--r--test/trans.d/case/scan3_ocaml.rl50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/trans.d/case/scan3_ocaml.rl b/test/trans.d/case/scan3_ocaml.rl
new file mode 100644
index 00000000..fb783612
--- /dev/null
+++ b/test/trans.d/case/scan3_ocaml.rl
@@ -0,0 +1,50 @@
+(*
+ * @LANG: ocaml
+ * @GENERATED: true
+ *)
+
+let ts = ref 0
+let te = ref 0
+let act = ref 0
+let token = ref 0
+
+%%{
+ machine scanner;
+
+ # Warning: changing the patterns or the input string will affect the
+ # coverage of the scanner action types.
+ main := |*
+ 'a' => {print_string( "pat1\n" );
+};
+ 'b' => {print_string( "pat2\n" );
+};
+ [ab] any* => {print_string( "pat3\n" );
+};
+ *|;
+}%%
+
+
+
+
+%% write data;
+
+let exec data =
+ let buffer = String.create(1024) in
+ let blen :int ref = ref 0 in
+ let cs = ref 0 in
+ let p = ref 0 in
+ let pe = ref (String.length data) in
+ let eof = pe in
+ %% write init;
+ %% write exec;
+ if !cs >= scanner_first_final then
+ print_string "ACCEPT\n"
+ else
+ print_string "FAIL\n"
+;;
+
+let () =
+ exec "ab89";
+ ()
+;;
+