diff options
Diffstat (limited to 'test/trans.d/case/scan4_ocaml.rl')
-rw-r--r-- | test/trans.d/case/scan4_ocaml.rl | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/trans.d/case/scan4_ocaml.rl b/test/trans.d/case/scan4_ocaml.rl new file mode 100644 index 00000000..21e13be8 --- /dev/null +++ b/test/trans.d/case/scan4_ocaml.rl @@ -0,0 +1,51 @@ +(* + * @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" ); +}; + + [ab]+ . 'c' => {print_string( "pat2\n" ); +}; + + any; + *|; +}%% + + + + +%% 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 "ba a"; + () +;; + |