Commit 8cc2fba7 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-03-10 12:11:46 by cvscast] Empty log message

Original author: cvscast
Date: 2003-03-10 12:11:46+00:00
parent 7ce3f096
......@@ -34,6 +34,22 @@ let make_result_char ch (code,r) =
) r in
(code,ret)
let tail_string i j s q =
if i + 1 = j then q else String (i + 1,j,s,q)
let make_result_string i j s q r1 r2 (code,r) =
let ret = Array.map
(function
| Catch -> String (i,j,s,q)
| Const c -> const c
| Left n -> if (n < 0) then Char (Chars.mk_char s.[i]) else r1.(n)
| Right m -> if (m < 0) then tail_string i j s q else r2.(m)
| Recompose (n,m) ->
Pair ((if (n < 0) then Char (Chars.mk_char s.[i]) else r1.(n)),
(if (m < 0) then tail_string i j s q else r2.(m)))
) r in
(code,ret)
let rec run_disp_basic v f = function
| [(_,r)] -> make_result_basic v r
| (t,r)::rem -> if f t then make_result_basic v r else run_disp_basic v f rem
......@@ -153,11 +169,11 @@ and run_disp_string_char d ch =
and run_disp_string2 r1 i j s q = function
| Impossible -> assert false
| Ignore r ->
make_result_prod Absent (* *) r1 Absent dummy_r Absent r
make_result_string i j s q r1 dummy_r r
| TailCall d2 -> run_disp_string_loop i j s q d2
| Dispatch (d2,b2) ->
let (code2,r2) = run_disp_string_loop i j s q d2 in
make_result_prod Absent (* *) r1 Absent r2 Absent b2.(code2)
make_result_string i j s q r1 r2 b2.(code2)
and run_disp_string_loop i j s q d =
match actions d with
| AIgnore r -> make_result_basic Absent r
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment