aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ltac/tacentries.ml6
-rw-r--r--plugins/ltac/tactic_debug.ml30
-rw-r--r--plugins/ltac/tactic_matching.ml19
3 files changed, 34 insertions, 21 deletions
diff --git a/plugins/ltac/tacentries.ml b/plugins/ltac/tacentries.ml
index 13a2f3b8c0..8b4520947b 100644
--- a/plugins/ltac/tacentries.ml
+++ b/plugins/ltac/tacentries.ml
@@ -191,7 +191,7 @@ let add_tactic_entry (kn, ml, tg) state =
in
let prods = List.map map tg.tacgram_prods in
let rules = make_rule mkact prods in
- let r = ExtendRule (entry, None, (pos, [(None, None, [rules])])) in
+ let r = ExtendRule (entry, (pos, [(None, None, [rules])])) in
([r], state)
let tactic_grammar =
@@ -415,7 +415,7 @@ let create_ltac_quotation name cast (e, l) =
in
let action _ v _ _ _ loc = cast (Some loc, v) in
let gram = (level, assoc, [Rule (rule, action)]) in
- Pcoq.grammar_extend Pltac.tactic_arg None (None, [gram])
+ Pcoq.grammar_extend Pltac.tactic_arg (None, [gram])
(** Command *)
@@ -759,7 +759,7 @@ let argument_extend (type a b c) ~name (arg : (a, b, c) tactic_argument) =
e
| Vernacextend.Arg_rules rules ->
let e = Pcoq.create_generic_entry Pcoq.utactic name (Genarg.rawwit wit) in
- let () = Pcoq.grammar_extend e None (None, [(None, None, rules)]) in
+ let () = Pcoq.grammar_extend e (None, [(None, None, rules)]) in
e
in
let (rpr, gpr, tpr) = arg.arg_printer in
diff --git a/plugins/ltac/tactic_debug.ml b/plugins/ltac/tactic_debug.ml
index 0e9465839a..392f9b2ffd 100644
--- a/plugins/ltac/tactic_debug.ml
+++ b/plugins/ltac/tactic_debug.ml
@@ -107,13 +107,29 @@ let db_initialize =
let int_of_string s =
try Proofview.NonLogical.return (int_of_string s)
- with e -> Proofview.NonLogical.raise e
+ with e ->
+ let e = Exninfo.capture e in
+ Proofview.NonLogical.raise e
let string_get s i =
try Proofview.NonLogical.return (String.get s i)
- with e -> Proofview.NonLogical.raise e
+ with e ->
+ let e = Exninfo.capture e in
+ Proofview.NonLogical.raise e
+
+let check_positive n =
+ try
+ if n < 0 then
+ raise (Invalid_argument "number must be positive")
+ else
+ Proofview.NonLogical.return ()
+ with e ->
+ let e = Exninfo.capture e in
+ Proofview.NonLogical.raise e
-let run_invalid_arg () = Proofview.NonLogical.raise (Invalid_argument "run_com")
+let run_invalid_arg () =
+ let info = Exninfo.null in
+ Proofview.NonLogical.raise (Invalid_argument "run_com", info)
(* Gives the number of steps or next breakpoint of a run command *)
let run_com inst =
@@ -125,7 +141,7 @@ let run_com inst =
let s = String.sub inst i (String.length inst - i) in
if inst.[0] >= '0' && inst.[0] <= '9' then
int_of_string s >>= fun num ->
- (if num<0 then run_invalid_arg () else return ()) >>
+ check_positive num >>
(skip:=num) >> (skipped:=0)
else
breakpoint:=Some (possibly_unquote s)
@@ -156,11 +172,11 @@ let rec prompt level =
let open Proofview.NonLogical in
Proofview.NonLogical.print_notice (fnl () ++ str "TcDebug (" ++ int level ++ str ") > ") >>
if Util.(!batch) then return (DebugOn (level+1)) else
- let exit = (skip:=0) >> (skipped:=0) >> raise Sys.Break in
+ let exit = (skip:=0) >> (skipped:=0) >> raise (Sys.Break, Exninfo.null) in
Proofview.NonLogical.catch Proofview.NonLogical.read_line
begin function (e, info) -> match e with
| End_of_file -> exit
- | e -> raise ~info e
+ | e -> raise (e, info)
end
>>= fun inst ->
match inst with
@@ -176,7 +192,7 @@ let rec prompt level =
Proofview.NonLogical.catch (run_com inst >> runtrue >> return (DebugOn (level+1)))
begin function (e, info) -> match e with
| Failure _ | Invalid_argument _ -> prompt level
- | e -> raise ~info e
+ | e -> raise (e, info)
end
end
diff --git a/plugins/ltac/tactic_matching.ml b/plugins/ltac/tactic_matching.ml
index eabfe2f540..2d5e9e53ce 100644
--- a/plugins/ltac/tactic_matching.ml
+++ b/plugins/ltac/tactic_matching.ml
@@ -227,11 +227,9 @@ module PatternMatching (E:StaticEnvironment) = struct
substitution. *)
let wildcard_match_term = return
- (** [pattern_match_term refresh pat term lhs] returns the possible
- matchings of [term] with the pattern [pat => lhs]. If refresh is
- true, refreshes the universes of [term]. *)
- let pattern_match_term refresh pat term lhs =
-(* let term = if refresh then Termops.refresh_universes_strict term else term in *)
+ (** [pattern_match_term pat term lhs] returns the possible
+ matchings of [term] with the pattern [pat => lhs]. *)
+ let pattern_match_term pat term lhs =
match pat with
| Term p ->
begin
@@ -262,7 +260,7 @@ module PatternMatching (E:StaticEnvironment) = struct
matching rule [rule]. *)
let rule_match_term term = function
| All lhs -> wildcard_match_term lhs
- | Pat ([],pat,lhs) -> pattern_match_term false pat term lhs
+ | Pat ([],pat,lhs) -> pattern_match_term pat term lhs
| Pat _ ->
(* Rules with hypotheses, only work in match goal. *)
fail
@@ -286,8 +284,7 @@ module PatternMatching (E:StaticEnvironment) = struct
let hyp_match_type hypname pat hyps =
pick hyps >>= fun decl ->
let id = NamedDecl.get_id decl in
- let refresh = is_local_def decl in
- pattern_match_term refresh pat (NamedDecl.get_type decl) () <*>
+ pattern_match_term pat (NamedDecl.get_type decl) () <*>
put_terms (id_map_try_add_name hypname (EConstr.mkVar id) empty_term_subst) <*>
return id
@@ -298,8 +295,8 @@ module PatternMatching (E:StaticEnvironment) = struct
let hyp_match_body_and_type hypname bodypat typepat hyps =
pick hyps >>= function
| LocalDef (id,body,hyp) ->
- pattern_match_term false bodypat body () <*>
- pattern_match_term true typepat hyp () <*>
+ pattern_match_term bodypat body () <*>
+ pattern_match_term typepat hyp () <*>
put_terms (id_map_try_add_name hypname (EConstr.mkVar id.binder_name) empty_term_subst) <*>
return id.binder_name
| LocalAssum (id,hyp) -> fail
@@ -337,7 +334,7 @@ module PatternMatching (E:StaticEnvironment) = struct
(* the rules are applied from the topmost one (in the concrete
syntax) to the bottommost. *)
let hyppats = List.rev hyppats in
- pattern_match_term false conclpat concl () <*>
+ pattern_match_term conclpat concl () <*>
hyp_pattern_list_match hyppats hyps lhs
(** [match_goal hyps concl rules] matches the goal [hyps|-concl]