- let res = match_cb (matched t) in
- (fun matched_terms terms ->
- match res matched_terms with
- None ->
- begin
- (* the match has failed, we rollback the last matched term
- * into the unmatched ones and call the failure continuation
- *)
- match matched_terms with
- hd :: tl -> k tl (hd :: terms)
- | _ -> assert false
- end
- | Some v -> Some v)