aboutsummaryrefslogtreecommitdiffhomepage
path: root/vernac
diff options
context:
space:
mode:
authorGravatar Vincent Laporte <Vincent.Laporte@gmail.com>2018-06-25 16:09:11 +0000
committerGravatar Vincent Laporte <Vincent.Laporte@gmail.com>2018-07-03 16:10:16 +0000
commitd3127693d4a2125088aa512f593d782843482f2a (patch)
treef96a8b0d0efd46ab223dc0d360ea7a48302dea0b /vernac
parent0a0e956929e28fd6f1c43f39d7b92aeeaf0f01e2 (diff)
[vernac] use plain strings as attribute names
The concrete syntax is still restricted to identifiers.
Diffstat (limited to 'vernac')
-rw-r--r--vernac/g_vernac.mlg14
-rw-r--r--vernac/ppvernac.ml2
-rw-r--r--vernac/vernacentries.ml5
-rw-r--r--vernac/vernacexpr.ml2
4 files changed, 11 insertions, 12 deletions
diff --git a/vernac/g_vernac.mlg b/vernac/g_vernac.mlg
index 23b6898c3..3afe3391b 100644
--- a/vernac/g_vernac.mlg
+++ b/vernac/g_vernac.mlg
@@ -96,7 +96,7 @@ GRAMMAR EXTEND Gram
]
;
attribute:
- [ [ k = ident ; v = attribute_value -> (k, v) ]
+ [ [ k = ident ; v = attribute_value -> (Names.Id.to_string k, v) ]
]
;
attribute_value:
@@ -106,23 +106,23 @@ GRAMMAR EXTEND Gram
]
;
vernac:
- [ [ IDENT "Local"; v = vernac_poly -> { let (f, v) = v in ((Names.Id.of_string "local", VernacFlagEmpty) :: f, v) }
- | IDENT "Global"; v = vernac_poly -> { let (f, v) = v in ((Names.Id.of_string "global", VernacFlagEmpty) :: f, v) }
+ [ [ IDENT "Local"; v = vernac_poly -> { let (f, v) = v in (("local", VernacFlagEmpty) :: f, v) }
+ | IDENT "Global"; v = vernac_poly -> { let (f, v) = v in (("global", VernacFlagEmpty) :: f, v) }
| v = vernac_poly -> { v } ]
]
;
vernac_poly:
- [ [ IDENT "Polymorphic"; v = vernac_aux -> { let (f, v) = v in ((Names.Id.of_string "polymorphic", VernacFlagEmpty) :: f, v) }
- | IDENT "Monomorphic"; v = vernac_aux -> { let (f, v) = v in ((Names.Id.of_string "monomorphic", VernacFlagEmpty) :: f, v) }
+ [ [ IDENT "Polymorphic"; v = vernac_aux -> { let (f, v) = v in (("polymorphic", VernacFlagEmpty) :: f, v) }
+ | IDENT "Monomorphic"; v = vernac_aux -> { let (f, v) = v in (("monomorphic", VernacFlagEmpty) :: f, v) }
| v = vernac_aux -> { v } ]
]
;
vernac_aux:
(* Better to parse "." here: in case of failure (e.g. in coerce_to_var), *)
(* "." is still in the stream and discard_to_dot works correctly *)
- [ [ IDENT "Program"; g = gallina; "." -> { ([Names.Id.of_string "program", VernacFlagEmpty], g) }
- | IDENT "Program"; g = gallina_ext; "." -> { ([Names.Id.of_string "program", VernacFlagEmpty], g) }
+ [ [ IDENT "Program"; g = gallina; "." -> { (["program", VernacFlagEmpty], g) }
+ | IDENT "Program"; g = gallina_ext; "." -> { (["program", VernacFlagEmpty], g) }
| g = gallina; "." -> { ([], g) }
| g = gallina_ext; "." -> { ([], g) }
| c = command; "." -> { ([], c) }
diff --git a/vernac/ppvernac.ml b/vernac/ppvernac.ml
index 024c145aa..e5547d9b7 100644
--- a/vernac/ppvernac.ml
+++ b/vernac/ppvernac.ml
@@ -1194,7 +1194,7 @@ open Pputils
return (str "}")
let rec pr_vernac_flag (k, v) =
- let k = keyword (Names.Id.to_string k) in
+ let k = keyword k in
match v with
| VernacFlagEmpty -> k
| VernacFlagLeaf v -> k ++ str " = " ++ qs v
diff --git a/vernac/vernacentries.ml b/vernac/vernacentries.ml
index e61687290..080d42607 100644
--- a/vernac/vernacentries.ml
+++ b/vernac/vernacentries.ml
@@ -2326,7 +2326,6 @@ let attributes_of_flags f atts =
in
List.fold_left
(fun (polymorphism, atts) (k, v) ->
- let k = Names.Id.to_string k in
match k with
| "program" when not atts.program ->
assert_empty k v;
@@ -2351,8 +2350,8 @@ let attributes_of_flags f atts =
user_err Pp.(str "Locality specified twice")
| "deprecated" when Option.is_empty atts.deprecated ->
begin match v with
- | VernacFlagList [ k1, VernacFlagLeaf since ; k2, VernacFlagLeaf note ]
- when Names.Id.(equal k1 (of_string "since") && equal k2 (of_string "note")) ->
+ | VernacFlagList [ "since", VernacFlagLeaf since ; "note", VernacFlagLeaf note ]
+ | VernacFlagList [ "note", VernacFlagLeaf note ; "since", VernacFlagLeaf since ] ->
(polymorphism, { atts with deprecated = Some (since, note) })
| _ -> CErrors.user_err (Pp.str "Ill formed “deprecated” attribute")
end
diff --git a/vernac/vernacexpr.ml b/vernac/vernacexpr.ml
index 2287630c7..e97cac818 100644
--- a/vernac/vernacexpr.ml
+++ b/vernac/vernacexpr.ml
@@ -459,7 +459,7 @@ type nonrec vernac_expr =
(* For extension *)
| VernacExtend of extend_name * Genarg.raw_generic_argument list
-type vernac_flags = (Names.Id.t * vernac_flag_value) list
+type vernac_flags = (string * vernac_flag_value) list
and vernac_flag_value =
| VernacFlagEmpty
| VernacFlagLeaf of string