aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Tassi2019-01-31 13:44:38 +0100
committerEnrico Tassi2019-02-13 13:55:57 +0100
commit8549847fc7df04a4896dc2ff4b29eb54a867b4b2 (patch)
treef1485082ddae95abba1077fbc197835127e5d5f1
parent454816235038540977826f1ab7ba96005639f5e1 (diff)
refactor grammar
-rw-r--r--vernac/g_vernac.mlg12
1 files changed, 7 insertions, 5 deletions
diff --git a/vernac/g_vernac.mlg b/vernac/g_vernac.mlg
index e7d81b8bb0..c36a6fa9c6 100644
--- a/vernac/g_vernac.mlg
+++ b/vernac/g_vernac.mlg
@@ -693,13 +693,15 @@ 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"; 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"; IDENT "Structure"; ntn = by_notation ->
{ VernacCanonical CAst.(make ~loc @@ ByNotation ntn) }
- | IDENT "Canonical"; IDENT "Structure"; qid = global; u = OPT univ_decl; d = def_body ->
- { let s = coerce_reference_to_id qid in
- VernacDefinition ((NoDischarge,CanonicalStructure),((CAst.make (Name s)),u),d) }
(* Coercions *)
| IDENT "Coercion"; qid = global; u = OPT univ_decl; d = def_body ->