Skip to content
Snippets Groups Projects
Commit 2d9eb07a authored by Loïc Correnson's avatar Loïc Correnson
Browse files

[wp] protect scripts crawling

parent e7370136
No related branches found
No related tags found
No related merge requests found
...@@ -312,6 +312,20 @@ and autofork env ~depth fork = ...@@ -312,6 +312,20 @@ and autofork env ~depth fork =
else else
( Env.validate env ; Task.return true ) ( Env.validate env ; Task.return true )
(* -------------------------------------------------------------------------- *)
(* --- Apply Script Tactic --- *)
(* -------------------------------------------------------------------------- *)
let apply env node jtactic subscripts =
match jfork (Env.tree env) ?node jtactic with
| None -> failwith "Selector not found"
| Some fork ->
let _,children = ProofEngine.commit fork in
reconcile children subscripts ; (*TODO: saveback forgiven script ? *)
List.filter
(fun (_,node) -> not (ProofEngine.proved node))
children
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
(* --- Script Crawling --- *) (* --- Script Crawling --- *)
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
...@@ -348,30 +362,26 @@ let rec crawl env on_child node = function ...@@ -348,30 +362,26 @@ let rec crawl env on_child node = function
| Tactic( _ , jtactic , subscripts ) :: alternative -> | Tactic( _ , jtactic , subscripts ) :: alternative ->
begin begin
match jfork (Env.tree env) ?node jtactic with try
| None -> let residual = apply env node jtactic subscripts in
Wp_parameters.warning if residual = [] then
"Script Error: on goal %a@\n\ Env.validate env
can not apply '%s'@\n\ else
@[<hov 2>Params: %a@]@\n\ List.iter (fun (_,n) -> on_child n) residual ;
@[<hov 2>Select: %a@]@." Task.return ()
WpPropId.pretty (Env.goal env node).po_pid with exn when Wp_parameters.protect exn ->
jtactic.tactic Wp_parameters.warning
Json.pp jtactic.params "Script Error: on goal %a@\n\
Json.pp jtactic.select ; can not apply '%s'@\n\
crawl env on_child node alternative exception %S@\n\
| Some fork -> @[<hov 2>Params: %a@]@\n\
(*TODO: saveback forgiven script *) @[<hov 2>Select: %a@]@."
let _,children = ProofEngine.commit fork in WpPropId.pretty (Env.goal env node).po_pid
reconcile children subscripts ; jtactic.tactic
let residual = List.filter (Printexc.to_string exn)
(fun (_,node) -> not (ProofEngine.proved node)) Json.pp jtactic.params
children in Json.pp jtactic.select ;
if residual = [] then crawl env on_child node alternative
Env.validate env
else
List.iter (fun (_,n) -> on_child n) children ;
Task.return ()
end end
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment