aboutsummaryrefslogtreecommitdiff
path: root/vernac
diff options
context:
space:
mode:
Diffstat (limited to 'vernac')
-rw-r--r--vernac/g_vernac.mlg18
1 files changed, 10 insertions, 8 deletions
diff --git a/vernac/g_vernac.mlg b/vernac/g_vernac.mlg
index 0664e18130..42bee25da3 100644
--- a/vernac/g_vernac.mlg
+++ b/vernac/g_vernac.mlg
@@ -693,18 +693,20 @@ GRAMMAR EXTEND Gram
LIST1 [ v=strategy_level; "["; q=LIST1 smart_global; "]" -> { (v,q) } ] ->
{ VernacSetStrategy l }
(* Canonical structure *)
- | IDENT "Canonical"; IDENT "Structure"; qid = global ->
- { VernacCanonical CAst.(make ~loc @@ AN qid) }
- | IDENT "Canonical"; IDENT "Structure"; ntn = by_notation ->
+ | IDENT "Canonical"; OPT [ IDENT "Structure" -> {()} ]; qid = global; ud = OPT [ u = OPT univ_decl; d = def_body -> { (u,d) } ] ->
+ { match ud with
+ | None ->
+ VernacCanonical CAst.(make ~loc @@ AN qid)
+ | Some (u,d) ->
+ let s = coerce_reference_to_id qid in
+ VernacDefinition ((NoDischarge,CanonicalStructure),((CAst.make (Name s)),u),d) }
+ | IDENT "Canonical"; OPT [ IDENT "Structure" -> {()} ]; ntn = by_notation ->
{ VernacCanonical CAst.(make ~loc @@ ByNotation ntn) }
- | IDENT "Canonical"; IDENT "Structure"; qid = global; d = def_body ->
- { let s = coerce_reference_to_id qid in
- VernacDefinition ((NoDischarge,CanonicalStructure),((CAst.make (Name s)),None),d) }
(* Coercions *)
- | IDENT "Coercion"; qid = global; d = def_body ->
+ | IDENT "Coercion"; qid = global; u = OPT univ_decl; d = def_body ->
{ let s = coerce_reference_to_id qid in
- VernacDefinition ((NoDischarge,Coercion),((CAst.make (Name s)),None),d) }
+ VernacDefinition ((NoDischarge,Coercion),((CAst.make (Name s)),u),d) }
| IDENT "Identity"; IDENT "Coercion"; f = identref; ":";
s = class_rawexpr; ">->"; t = class_rawexpr ->
{ VernacIdentityCoercion (f, s, t) }