Commit af677b2a authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-03-10 00:48:15 by cvscast] Empty log message

Original author: cvscast
Date: 2003-03-10 00:48:15+00:00
parent e7b379f1
......@@ -25,6 +25,15 @@ let make_result_basic v (code,r) =
) r in
(code,ret)
let make_result_char ch (code,r) =
let ret = Array.map
(function
| Catch -> Char ch
| Const c -> const c
| _ -> assert false
) 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
......@@ -47,6 +56,7 @@ and run_disp_kind actions v =
| Pair (v1,v2) -> run_disp_prod v v1 v2 actions.prod
| Xml (v1,v2) -> run_disp_prod v v1 v2 actions.xml
| Record r -> run_disp_record false v r actions.record
| String (i,j,s,q) -> run_disp_string i j s q actions
| Atom a ->
run_disp_basic v (fun t -> Types.Atom.has_atom t a) actions.basic
| Char c ->
......@@ -115,5 +125,43 @@ and run_disp_record2 other v1 r1 rem = function
and run_disp_record_loop other rem d =
match actions d with
| AIgnore r -> make_result_basic Absent r
| AKind k -> run_disp_record other (Pair(Absent,Absent)) rem k.record
| AKind k -> run_disp_record other Absent rem k.record
and run_disp_string i j s q actions =
if i = j then run_disp_kind actions q
else match actions.prod with
| Impossible -> assert false
| TailCall d1 -> run_disp_string_char d1 (Chars.mk_char s.[i])
| Ignore d2 -> run_disp_string2 dummy_r i j s q d2
| Dispatch (d1,b1) ->
let (code1,r1) = run_disp_string_char d1 (Chars.mk_char s.[i]) in
run_disp_string2 r1 i j s q b1.(code1)
and run_disp_string_char d ch =
match actions d with
| AIgnore r -> make_result_char ch r
| AKind k ->
let rec aux ch = function
| [(_,r)] -> make_result_char ch r
| (t,r)::rem ->
if Types.Char.has_char t ch then
make_result_char ch r
else aux ch rem
| _ -> assert false
in
aux ch k.basic
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
| 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)
and run_disp_string_loop i j s q d =
match actions d with
| AIgnore r -> make_result_basic Absent r
| AKind k -> run_disp_string (succ i) j s q k
(* TODO: finir d'implmenter les capture pour les string ... *)
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