diff options
Diffstat (limited to 'test/rlhc.d/case/scan6.ml-O-F1--var-backend.exp')
-rw-r--r-- | test/rlhc.d/case/scan6.ml-O-F1--var-backend.exp | 314 |
1 files changed, 314 insertions, 0 deletions
diff --git a/test/rlhc.d/case/scan6.ml-O-F1--var-backend.exp b/test/rlhc.d/case/scan6.ml-O-F1--var-backend.exp new file mode 100644 index 00000000..73244d1d --- /dev/null +++ b/test/rlhc.d/case/scan6.ml-O-F1--var-backend.exp @@ -0,0 +1,314 @@ +(* +* @LANG: ocaml +*) + +let id x = x +let fail fmt = Printf.ksprintf failwith fmt +let pr fmt = Printf.ksprintf print_endline fmt + +let failed fmt = Printf.ksprintf (fun s -> prerr_endline s; exit 1) fmt +let test' show f x y = if f x <> y then failed "FAILED: test %S" (show x) +let case = ref 0 +let test f x y = incr case; if f x <> y then failed "FAILED: case %d" !case +let error f x = match try Some (f x) with _ -> None with Some _ -> failed "FAILED: fail %S" x | None -> () + +let _scanner_trans_keys : int array = [| +0; 2; 0; 1; 0; 2; 0 ; +|] +let _scanner_char_class : int array = [| +0; 1; 2; 0 ; +|] +let _scanner_index_offsets : int array = [| +0; 3; 5; 0 ; +|] +let _scanner_indicies : int array = [| +1; 1; 2; 4; 5; 1; 1; 2; 0 ; +|] +let _scanner_index_defaults : int array = [| +0; 3; 0; 0 ; +|] +let _scanner_trans_cond_spaces : int array = [| +-1; -1; -1; -1; -1; -1; 0 ; +|] +let _scanner_cond_targs : int array = [| +1; 0; 1; 1; 2; 2; 0 ; +|] +let _scanner_cond_actions : int array = [| +1; 0; 2; 5; 6; 7; 0 ; +|] +let _scanner_to_state_actions : int array = [| +0; 3; 0; 0 ; +|] +let _scanner_from_state_actions : int array = [| +0; 4; 0; 0 ; +|] +let _scanner_eof_trans : int array = [| +1; 0; 1; 0 ; +|] +let _scanner_nfa_targs : int array = [| +0; 0 ; +|] +let _scanner_nfa_offsets : int array = [| +0; 0; 0; 0 ; +|] +let _scanner_nfa_push_actions : int array = [| +0; 0 ; +|] +let _scanner_nfa_pop_trans : int array = [| +0; 0 ; +|] +let scanner_start : int = 1 +let scanner_first_final : int = 1 +let scanner_error : int = -1 +let scanner_en_main : int = 1 +let fail fmt = Printf.ksprintf failwith fmt + +let () = +let expect = ref [`Pat1; `Any; `Pat2; `Any; `Any; `Any; ] in +let got z = match !expect with +| [] -> fail "nothing more expected" +| x::xs -> expect := xs; if z <> x then fail "mismatch" +in +let ts = ref 0 and te = ref 0 and cs = ref 0 and act = ref 0 in +let data = "araabccde" in +let p = ref 0 and pe = ref (String.length data) in +let eof = ref !pe in +begin + cs := scanner_start; + ts := 0; + te := 0; + act := 0; + +end; +begin + let _trans : int ref = ref 0 in + let _have : int ref = ref 0 in + let _cont : int ref = ref 1 in + let _keys : int ref = ref 0 in + let _inds : int ref = ref 0 in + while _cont.contents= 1 do + begin + _have := 0; + if p.contents= pe.contents then + begin + begin + if p.contents= eof.contents then + begin + begin + if _scanner_eof_trans.(cs.contents)> 0 then + begin + begin + _trans := _scanner_eof_trans.(cs.contents)- 1; + _have := 1; + + end; + + end + ;if _have.contents= 0 then + begin + begin + + end; + + end + ; + end; + + end + ;if _have.contents= 0 then + begin + _cont := 0; + + end + ; + end; + + end + ;if _cont.contents= 1 then + begin + begin + if _have.contents= 0 then + begin + begin + if _scanner_from_state_actions.(cs.contents) = 4 then + begin + begin + begin + ts := p.contents; + + end; + + end; + + end + ; + _keys := ( cs.contents lsl 1 ); + _inds := _scanner_index_offsets.(cs.contents); + if ( Char.code data.[p.contents] )<= 99 && ( Char.code data.[p.contents] )>= 97 then + begin + begin + let _ic : int ref = ref _scanner_char_class.(( Char.code data.[p.contents] )- 97) in + if _ic.contents<= _scanner_trans_keys.( _keys.contents+1 )&& _ic.contents>= _scanner_trans_keys.( _keys.contents ) then + begin + _trans := _scanner_indicies.( _inds.contents+ ( _ic.contents- _scanner_trans_keys.( _keys.contents ) ) ); + + end + else + begin + _trans := _scanner_index_defaults.(cs.contents); + + end + ; + end; + + end + else + begin + begin + _trans := _scanner_index_defaults.(cs.contents); + + end; + + end + ; + end; + + end + ;if _cont.contents= 1 then + begin + begin + cs := _scanner_cond_targs.(_trans.contents); + if _scanner_cond_actions.(_trans.contents) = 2 then + begin + begin + begin + te := p.contents+1; + begin + got `Pat2; + print_string "got pat2\n"; + + end; + + end; + + end; + + end + else if _scanner_cond_actions.(_trans.contents) = 5 then + begin + begin + begin + te := p.contents+1; + begin + got `Any; + print_string "got any\n"; + + end; + + end; + + end; + + end + else if _scanner_cond_actions.(_trans.contents) = 1 then + begin + begin + begin + if act.contents = 1 then + begin + p := ( ( te.contents ) )-1; + begin + got `Pat1; + print_string "got pat1\n"; + + end; + + end + else if act.contents = 3 then + begin + p := ( ( te.contents ) )-1; + begin + got `Any; + print_string "got any\n"; + + end; + + end + ; + + end; + + + end; + + end + else if _scanner_cond_actions.(_trans.contents) = 6 then + begin + begin + begin + te := p.contents+1; + + end; + + end; + begin + begin + act := 1; + + end; + + end; + + end + else if _scanner_cond_actions.(_trans.contents) = 7 then + begin + begin + begin + te := p.contents+1; + + end; + + end; + begin + begin + act := 3; + + end; + + end; + + end + ; + if _scanner_to_state_actions.(cs.contents) = 3 then + begin + begin + begin + ts := 0; + + end; + + end; + + end + ; + if _cont.contents= 1 then + begin + p := p.contents + 1; + + end + ; + end; + + end + ; + end; + + end + ; + end; + + done; + +end; +() + |