From 90e5407fcfc59dce5ea592aeae6195183a2b4ad2 Mon Sep 17 00:00:00 2001 From: herbelin Date: Sun, 30 Mar 2008 21:42:58 +0000 Subject: Ajout d'abbréviations/notations paramétriques Example: "Notation reflexive R := (forall x, R x x)." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@10730 85f007b7-540e-0410-9357-904b9bb8a0f7 --- toplevel/command.ml | 6 +++--- toplevel/command.mli | 3 ++- toplevel/metasyntax.ml | 4 ++-- toplevel/vernacexpr.ml | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'toplevel') diff --git a/toplevel/command.ml b/toplevel/command.ml index 4f26cd1eb..fbba7a4ee 100644 --- a/toplevel/command.ml +++ b/toplevel/command.ml @@ -163,9 +163,9 @@ let declare_definition ident (local,boxed,dok) bl red_option c typopt hook = declare_global_definition ident ce' local imps in hook local r -let syntax_definition ident c local onlyparse = - let c = snd (interp_aconstr [] [] c) in - Syntax_def.declare_syntactic_definition local ident onlyparse c +let syntax_definition ident (vars,c) local onlyparse = + let pat = interp_aconstr [] vars c in + Syntax_def.declare_syntactic_definition local ident onlyparse pat (* 2| Variable/Hypothesis/Parameter/Axiom declarations *) diff --git a/toplevel/command.mli b/toplevel/command.mli index 31420d189..942fd2c31 100644 --- a/toplevel/command.mli +++ b/toplevel/command.mli @@ -39,7 +39,8 @@ val declare_definition : identifier -> definition_kind -> local_binder list -> red_expr option -> constr_expr -> constr_expr option -> declaration_hook -> unit -val syntax_definition : identifier -> constr_expr -> bool -> bool -> unit +val syntax_definition : identifier -> identifier list * constr_expr -> + bool -> bool -> unit val declare_one_assumption : coercion_flag -> assumption_kind -> Term.types -> Impargs.manual_explicitation list -> bool -> Names.variable located -> unit diff --git a/toplevel/metasyntax.ml b/toplevel/metasyntax.ml index d9a82a413..f8f8c9ad2 100644 --- a/toplevel/metasyntax.ml +++ b/toplevel/metasyntax.ml @@ -854,8 +854,8 @@ let cache_notation o = load_notation 1 o; open_notation 1 o -let subst_notation (_,subst,(lc,scope,(metas,pat),b,ndf)) = - (lc,scope,(metas,subst_aconstr subst (List.map fst metas) pat),b,ndf) +let subst_notation (_,subst,(lc,scope,pat,b,ndf)) = + (lc,scope,subst_interpretation subst pat,b,ndf) let classify_notation (_,(local,_,_,_,_ as o)) = if local then Dispose else Substitute o diff --git a/toplevel/vernacexpr.ml b/toplevel/vernacexpr.ml index 4579d43a6..839f3ee46 100644 --- a/toplevel/vernacexpr.ml +++ b/toplevel/vernacexpr.ml @@ -287,8 +287,8 @@ type vernac_expr = | VernacDeclareTacticDefinition of rec_flag * (lident * bool * raw_tactic_expr) list | VernacHints of locality_flag * lstring list * hints - | VernacSyntacticDefinition of identifier * constr_expr * locality_flag * - onlyparsing_flag + | VernacSyntacticDefinition of identifier * (identifier list * constr_expr) * + locality_flag * onlyparsing_flag | VernacDeclareImplicits of locality_flag * lreference * bool * (explicitation * bool * bool) list option | VernacReserve of lident list * constr_expr -- cgit v1.2.3