diff options
Diffstat (limited to 'test/trans.d/case/eofact_ocaml.rl')
-rw-r--r-- | test/trans.d/case/eofact_ocaml.rl | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/test/trans.d/case/eofact_ocaml.rl b/test/trans.d/case/eofact_ocaml.rl new file mode 100644 index 00000000..e8579c32 --- /dev/null +++ b/test/trans.d/case/eofact_ocaml.rl @@ -0,0 +1,61 @@ +(* + * @LANG: ocaml + * @GENERATED: true + *) + + + + +%%{ + machine eofact; + + action a1 {print_string( "a1\n" ); +} + action a2 {print_string( "a2\n" ); +} + action a3 {print_string( "a3\n" ); +} + action a4 {print_string( "a4\n" ); +} + + + main := ( + 'hello' @eof a1 %eof a2 '\n'? | + 'there' @eof a3 %eof a4 + ); + +}%% + + + + +%% 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 >= eofact_first_final then + print_string "ACCEPT\n" + else + print_string "FAIL\n" +;; + +let () = + exec ""; + exec "h"; + exec "hell"; + exec "hello"; + exec "hello\n"; + exec "t"; + exec "ther"; + exec "there"; + exec "friend"; + () +;; + |