Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to Coq PR #19301: unify the syntax of definition and theorem #932

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions language-server/dm/document.ml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ let range_of_id_with_blank_space document id =
| None -> CErrors.anomaly Pp.(str"Trying to get range of non-existing sentence " ++ Stateid.print id)
| Some sentence -> range_of_sentence_with_blank_space document.raw_doc sentence

[%%if coq = "8.18" || coq = "8.19" || coq = "8.20"]
let kind_of_vernac_syn_pure = function
| Vernacexpr.VernacStartTheoremProof (kind, _) -> Some (TheoremKind kind), "theorem"
| Vernacexpr.VernacDefinition ((_, def), _, _) -> Some (DefinitionType def), "definition"
| _ -> None, ""
[%%else]
let kind_of_vernac_syn_pure = function
| Vernacexpr.VernacDefinition ((_, IsTheoremKind kind), _) -> Some (TheoremKind kind), "theorem"
| Vernacexpr.VernacDefinition ((_, IsDefinitionKind def), _) -> Some (DefinitionType def), "definition"
| _ -> None, ""
[%%endif]

let record_outline document id (ast : Synterp.vernac_control_entry) classif (outline : outline) =
let open Vernacextend in
Expand All @@ -120,11 +131,7 @@ let record_outline document id (ast : Synterp.vernac_control_entry) classif (out
let vernac_gen_expr = ast.v.expr in
let type_, statement = match vernac_gen_expr with
| VernacSynterp _ -> None, ""
| VernacSynPure pure ->
match pure with
| Vernacexpr.VernacStartTheoremProof (kind, _) -> Some (TheoremKind kind), "theorem"
| Vernacexpr.VernacDefinition ((_, def), _, _) -> Some (DefinitionType def), "definition"
| _ -> None, ""
| VernacSynPure pure -> kind_of_vernac_syn_pure pure
in
let name = match names with
|[] -> "default"
Expand All @@ -142,11 +149,7 @@ let record_outline document id (ast : Synterp.vernac_control_entry) classif (out
let type_, statement = match vernac_gen_expr with
| VernacSynterp (Synterp.EVernacExtend _) when names <> [] -> Some Other, "external"
| VernacSynterp _ -> None, ""
| VernacSynPure pure ->
match pure with
| Vernacexpr.VernacStartTheoremProof (kind, _) -> Some (TheoremKind kind), "theroem"
| Vernacexpr.VernacDefinition ((_, def), _, _) -> Some (DefinitionType def), "definition"
| _ -> None, ""
| VernacSynPure pure -> kind_of_vernac_syn_pure pure
in
let name = match names with
|[] -> "default"
Expand Down
Loading