aboutsummaryrefslogtreecommitdiffhomepage
path: root/vernac/vernacinterp.ml
diff options
context:
space:
mode:
authorGravatar Emilio Jesus Gallego Arias <e+git@x80.org>2017-11-20 16:19:41 +0100
committerGravatar Emilio Jesus Gallego Arias <e+git@x80.org>2017-11-27 19:44:28 +0100
commit4aba7c162905c61b3bb1a9f8d5c325de38b5847a (patch)
treed65724fb8941c208f86047b62fbef1229f9c5964 /vernac/vernacinterp.ml
parent437f20f0a1c2717cd7baae52e2ab20750dd9d4fb (diff)
[vernac] Start to uniformize type of vernac interpretation.
In particular, we put all the context in the atts structure, and generalize the type of the parameters of a vernac. I hope this helps people working on "attributes", my motivation is indeed having a more robust interpretation.
Diffstat (limited to 'vernac/vernacinterp.ml')
-rw-r--r--vernac/vernacinterp.ml14
1 files changed, 6 insertions, 8 deletions
diff --git a/vernac/vernacinterp.ml b/vernac/vernacinterp.ml
index 47dec1958..db9eab146 100644
--- a/vernac/vernacinterp.ml
+++ b/vernac/vernacinterp.ml
@@ -17,15 +17,14 @@ type atts = {
locality : bool option;
}
-type vernac_command =
- Genarg.raw_generic_argument list ->
- atts:atts -> st:Vernacstate.t ->
- Vernacstate.t
+type 'a vernac_command = 'a -> atts:atts -> st:Vernacstate.t -> Vernacstate.t
+
+type plugin_args = Genarg.raw_generic_argument list
(* Table of vernac entries *)
let vernac_tab =
(Hashtbl.create 211 :
- (Vernacexpr.extend_name, deprecation * vernac_command) Hashtbl.t)
+ (Vernacexpr.extend_name, deprecation * plugin_args vernac_command) Hashtbl.t)
let vinterp_add depr s f =
try
@@ -58,7 +57,7 @@ let warn_deprecated_command =
(* Interpretation of a vernac command *)
-let call ?locality ?loc (opn,converted_args) =
+let call opn converted_args ~atts ~st =
let phase = ref "Looking up command" in
try
let depr, callback = vinterp_map opn in
@@ -74,8 +73,7 @@ let call ?locality ?loc (opn,converted_args) =
phase := "Checking arguments";
let hunk = callback converted_args in
phase := "Executing command";
- let atts = { loc; locality } in
- hunk ~atts
+ hunk ~atts ~st
with
| Drop -> raise Drop
| reraise ->