diff options
| author | herbelin | 2012-03-20 13:59:03 +0000 |
|---|---|---|
| committer | herbelin | 2012-03-20 13:59:03 +0000 |
| commit | d288152f7d886ca6dba3944d20c6ca21452533da (patch) | |
| tree | 5023c82f344fd90429fa1efffcb2273cb905843c /toplevel | |
| parent | 2e23b8850d533f94d7bab6d58afb7044c5cb4f66 (diff) | |
Continuing r15045-15046 and r15055 (fixing bug #2732 about atomic
tactic arguments of ltac functions).
Added support for recursive entries in ARGUMENT EXTEND, for right-hand
sides of ARGUMENT EXTEND raising exceptions and for right-hand sides
referring to "loc". Also fixed parsing level of initial value in
create_arg (raw instead of glob). Thanks to the Ssreflect plugin for
revealing these problems.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15065 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'toplevel')
| -rw-r--r-- | toplevel/command.ml | 4 | ||||
| -rw-r--r-- | toplevel/metasyntax.ml | 12 | ||||
| -rw-r--r-- | toplevel/metasyntax.mli | 2 |
3 files changed, 16 insertions, 2 deletions
diff --git a/toplevel/command.ml b/toplevel/command.ml index 3657c5d5af..8bb875ffb5 100644 --- a/toplevel/command.ml +++ b/toplevel/command.ml @@ -273,7 +273,7 @@ let interp_mutual_inductive (paramsl,indl) notations finite = let mldatas = List.map2 (mk_mltype_data evdref env_params params) arities indnames in let constructors = - States.with_state_protection (fun () -> + Metasyntax.with_syntax_protection (fun () -> (* Temporary declaration of notations and scopes *) List.iter (Metasyntax.set_notation_for_interpretation impls) notations; (* Interpret the constructor types *) @@ -753,7 +753,7 @@ let interp_recursive isfix fixl notations = (* Interp bodies with rollback because temp use of notations/implicit *) let fixdefs = - States.with_state_protection (fun () -> + Metasyntax.with_syntax_protection (fun () -> List.iter (Metasyntax.set_notation_for_interpretation impls) notations; list_map3 (interp_fix_body evdref env_rec impls) fixctxs fixl fixccls) () in diff --git a/toplevel/metasyntax.ml b/toplevel/metasyntax.ml index 76326f51ff..8415f0bcc9 100644 --- a/toplevel/metasyntax.ml +++ b/toplevel/metasyntax.ml @@ -987,6 +987,18 @@ let inNotation : notation_obj -> obj = classify_function = classify_notation} (**********************************************************************) + +let with_lib_stk_protection f x = + let fs = Lib.freeze () in + try let a = f x in Lib.unfreeze fs; a + with e -> Lib.unfreeze fs; raise e + +let with_syntax_protection f x = + with_lib_stk_protection + (with_grammar_rule_protection + (with_notation_protection f)) x + +(**********************************************************************) (* Recovering existing syntax *) let contract_notation ntn = diff --git a/toplevel/metasyntax.mli b/toplevel/metasyntax.mli index 74a8e0fe9c..e228b829ac 100644 --- a/toplevel/metasyntax.mli +++ b/toplevel/metasyntax.mli @@ -62,3 +62,5 @@ val add_syntactic_definition : identifier -> identifier list * constr_expr -> val print_grammar : string -> unit val check_infix_modifiers : syntax_modifier list -> unit + +val with_syntax_protection : ('a -> 'b) -> 'a -> 'b |
