aboutsummaryrefslogtreecommitdiffhomepage
path: root/parsing/g_vernac.ml4
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-07-05 16:55:59 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-07-05 16:55:59 +0000
commitf93f073df630bb46ddd07802026c0326dc72dafd (patch)
tree35035375b5c6260ce6f89ccfbbf95a140e562005 /parsing/g_vernac.ml4
parentd655986bc6d54c320a6ddd642cefde4a7f3088a9 (diff)
Notation: a new annotation "compat 8.x" extending "only parsing"
Suppose we declare : Notation foo := bar (compat "8.3"). Then each time foo is used in a script : - By default nothing particular happens (for the moment) - But we could get a warning explaining that "foo is bar since coq > 8.3". For that, either use the command-line option -verb-compat-notations or the interactive command "Set Verbose Compat Notations". - There is also a strict mode, where foo is forbidden : the previous warning is now an error. For that, either use the command-line option -no-compat-notations or the interactive command "Unset Compat Notations". When Coq is launched in compatibility mode (via -compat 8.x), using a notation tagged "8.x" will never trigger a warning or error. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15514 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'parsing/g_vernac.ml4')
-rw-r--r--parsing/g_vernac.ml415
1 files changed, 12 insertions, 3 deletions
diff --git a/parsing/g_vernac.ml4 b/parsing/g_vernac.ml4
index fbf1c64f2..509d266be 100644
--- a/parsing/g_vernac.ml4
+++ b/parsing/g_vernac.ml4
@@ -985,8 +985,7 @@ GEXTEND Gram
sc = OPT [ ":"; sc = IDENT -> sc ] ->
VernacInfix (enforce_module_locality local,(op,modl),p,sc)
| IDENT "Notation"; local = obsolete_locality; id = identref;
- idl = LIST0 ident; ":="; c = constr;
- b = [ "("; IDENT "only"; IDENT "parsing"; ")" -> true | -> false ] ->
+ idl = LIST0 ident; ":="; c = constr; b = only_parsing ->
VernacSyntacticDefinition
(id,(idl,c),enforce_module_locality local,b)
| IDENT "Notation"; local = obsolete_locality; s = ne_lstring; ":=";
@@ -1014,6 +1013,13 @@ GEXTEND Gram
to factorize with other "Print"-based vernac entries *)
] ]
;
+ only_parsing:
+ [ [ "("; IDENT "only"; IDENT "parsing"; ")" ->
+ Some Flags.Current
+ | "("; IDENT "compat"; s = STRING; ")" ->
+ Some (Coqinit.get_compat_version s)
+ | -> None ] ]
+ ;
obsolete_locality:
[ [ IDENT "Local" -> true | -> false ] ]
;
@@ -1029,7 +1035,10 @@ GEXTEND Gram
| IDENT "left"; IDENT "associativity" -> SetAssoc LeftA
| IDENT "right"; IDENT "associativity" -> SetAssoc RightA
| IDENT "no"; IDENT "associativity" -> SetAssoc NonA
- | IDENT "only"; IDENT "parsing" -> SetOnlyParsing
+ | IDENT "only"; IDENT "parsing" ->
+ SetOnlyParsing Flags.Current
+ | IDENT "compat"; s = STRING ->
+ SetOnlyParsing (Coqinit.get_compat_version s)
| IDENT "format"; s = [s = STRING -> (loc,s)] -> SetFormat s
| x = IDENT; ","; l = LIST1 [id = IDENT -> id ] SEP ","; "at";
lev = level -> SetItemLevel (x::l,lev)