package coq-serapi
Serialization library and protocol for machine interaction with the Coq proof assistant
Install
Dune Dependency
Authors
Maintainers
Sources
coq-serapi-8.13.0.0.13.0.tbz
sha256=ddef1d7278021ce391f62e8e222e10962c7a308d6a2dfd8320382b4cf9a8cd75
sha512=8ee9cc09e5b8708b6cd7b0af8fccaa900413aa106cb47d99ca1fdd5b39c52676fa906204766f8f9e0964cc7e3ef987009de79f26b534b2021cf66f20c3d62bfe
doc/src/coq-serapi.sertop_v8_12/sertop_ser.ml.html
Source file sertop_ser.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
(************************************************************************) (* * The Coq Proof Assistant / The Coq Development Team *) (* v * INRIA, CNRS and contributors - Copyright 1999-2018 *) (* <O___,, * (see CREDITS file for the list of authors) *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (* * (see LICENSE file for the text of the license) *) (************************************************************************) (************************************************************************) (* Coq serialization API/Plugin *) (* Copyright 2016-2018 MINES ParisTech -- Dual License LGPL 2.1 / GPL3+ *) (* Written by: Emilio J. Gallego Arias *) (************************************************************************) (* Status: Very Experimental *) (************************************************************************) open Sexplib open Sexplib.Conv open Serlib type ser_printer = | SP_Sertop (* sertop custom printer (UTF-8, stronger quoting) *) | SP_Mach (* sexplib mach printer *) | SP_Human (* sexplib human printer *) let select_printer pr = match pr with | SP_Sertop -> Sertop_util.pp_sertop | SP_Mach -> Sexp.pp | SP_Human -> Sexp.pp_hum module SP = Serapi.Serapi_protocol (******************************************************************************) (* Exception Registration *) (******************************************************************************) (* We play slow for now *) let _ = (* XXX Finish this *) let open Sexp in let sexp_of_std_ppcmds pp = Atom (Pp.string_of_ppcmds pp) in Conv.Exn_converter.add [%extension_constructor SP.NoSuchState] (function (* Own things *) | SP.NoSuchState sid -> List [Atom "NoSuchState"; Ser_stateid.sexp_of_t sid] | _ -> assert false); Conv.Exn_converter.add [%extension_constructor CErrors.UserError] (function (* Errors *) | CErrors.UserError(hdr,msg) -> let hdr = Option.default "" hdr in List [Atom "CErrors.UserError"; List [Atom hdr; sexp_of_std_ppcmds msg]] | _ -> assert false); Conv.Exn_converter.add [%extension_constructor DeclareUniv.AlreadyDeclared] (function | DeclareUniv.AlreadyDeclared (msg, id) -> List [Atom "Declare.AlreadyDeclared"; List [sexp_of_option sexp_of_string msg; Ser_names.Id.sexp_of_t id]] | _ -> assert false); Conv.Exn_converter.add [%extension_constructor Pretype_errors.PretypeError] (function (* Pretype Errors XXX what to do with _env, _envmap *) | Pretype_errors.PretypeError(_env, _evmap, pterr) -> List [Atom "Pretype_errors.PretypeError"; List [Ser_pretype_errors.sexp_of_pretype_error pterr]] | _ -> assert false); (* Conv.Exn_converter.add [%extension_constructor Proof_global.NoCurrentProof] (function * | Proof_global.NoCurrentProof -> * Atom "NoCurrentProof" * | _ -> assert false) *) (* Private... request Coq devs to make them public? | Errors.Anomaly(msgo, pp) -> Some (List [Atom "Anomaly"; sexp_of_option sexp_of_string msgo; sexp_of_std_ppcmds pp]) *) (******************************************************************************) (* Serialization of the Protocol *) (******************************************************************************) module Loc = Ser_loc module CAst = Ser_cAst module Pp = Ser_pp module Names = Ser_names module Environ = Ser_environ module Goptions = Ser_goptions module Stateid = Ser_stateid module Evar = Ser_evar module Context = Ser_context module Feedback = Ser_feedback module Libnames = Ser_libnames module Globnames = Ser_globnames module Impargs = Ser_impargs module Constr = Ser_constr module Constrexpr = Ser_constrexpr module Proof = Ser_proof module Goal = Ser_goal module Tok = Ser_tok module Ppextend = Ser_ppextend module Notation_gram = Ser_notation_gram module Genarg = Ser_genarg module Loadpath = Ser_loadpath module Printer = Ser_printer (* Alias fails due to the [@@default in protocol] *) (* module Stm = Ser_stm *) module Ser_stm = Ser_stm module Ltac_plugin = struct module Tacenv = Serlib_ltac.Ser_tacenv module Profile_ltac = Serlib_ltac.Ser_profile_ltac module Tacexpr = Serlib_ltac.Ser_tacexpr end module Notation = Ser_notation module Xml_datatype = Ser_xml_datatype module Notation_term = Ser_notation_term module Vernacexpr = Ser_vernacexpr module Declarations = Ser_declarations (* module Richpp = Ser_richpp *) module Serapi = struct module Serapi_goals = struct type 'a hyp = [%import: 'a Serapi.Serapi_goals.hyp] [@@deriving sexp] type info = [%import: Serapi.Serapi_goals.info] [@@deriving sexp] type 'a reified_goal = [%import: 'a Serapi.Serapi_goals.reified_goal] [@@deriving sexp] type 'a ser_goals = [%import: 'a Serapi.Serapi_goals.ser_goals] [@@deriving sexp] end module Serapi_assumptions = struct type ax_ctx = [%import: Serapi.Serapi_assumptions.ax_ctx] [@@deriving sexp] type t = [%import: Serapi.Serapi_assumptions.t] [@@deriving sexp] end module Serapi_protocol = Serapi.Serapi_protocol end (* Serialization to sexp *) type coq_object = [%import: Serapi.Serapi_protocol.coq_object] [@@deriving sexp] exception AnswerExn of Sexp.t let exn_of_sexp sexp = AnswerExn sexp type print_format = [%import: Serapi.Serapi_protocol.print_format] [@@deriving sexp] type format_opt = [%import: Serapi.Serapi_protocol.format_opt] [@@deriving sexp] type print_opt = [%import: Serapi.Serapi_protocol.print_opt] [@@deriving sexp] type query_pred = [%import: Serapi.Serapi_protocol.query_pred] [@@deriving sexp] type query_opt = [%import: Serapi.Serapi_protocol.query_opt [@with Sexplib.Conv.sexp_list := sexp_list; Sexplib.Conv.sexp_option := sexp_option; ]] [@@deriving sexp] type query_cmd = [%import: Serapi.Serapi_protocol.query_cmd] [@@deriving sexp] type cmd_tag = [%import: Serapi.Serapi_protocol.cmd_tag] [@@deriving sexp] type location = [%import: Printexc.location] [@@deriving sexp] type raw_backtrace = Printexc.raw_backtrace let raw_backtrace_of_sexp _ = Printexc.get_raw_backtrace () type slot_rep = { slot_loc : location option; slot_idx : int; slot_str : string option; } [@@deriving sexp] let to_slot_rep idx bs = { slot_loc = Printexc.Slot.location bs; slot_idx = idx; slot_str = Printexc.Slot.format idx bs; } let sexp_of_backtrace_slot idx bs = sexp_of_slot_rep (to_slot_rep idx bs) let sexp_of_raw_backtrace (bt : Printexc.raw_backtrace) : Sexp.t = let bt = Printexc.backtrace_slots bt in let bt = Option.map Array.(mapi sexp_of_backtrace_slot) bt in let bt = sexp_of_option (sexp_of_array (fun x -> x)) bt in Sexp.(List [Atom "Backtrace"; bt]) module ExnInfo = struct type t = [%import: Serapi.Serapi_protocol.ExnInfo.t [@with Stm.focus := Ser_stm.focus; Printexc.raw_backtrace := raw_backtrace; Stdlib.Printexc.raw_backtrace := raw_backtrace; ]] [@@deriving sexp] end type answer_kind = [%import: Serapi.Serapi_protocol.answer_kind [@with Exninfo.t := Exninfo.t; ]] [@@deriving sexp] type feedback_content = [%import: Serapi.Serapi_protocol.feedback_content] [@@deriving sexp] type feedback = [%import: Serapi.Serapi_protocol.feedback] [@@deriving sexp] type answer = [%import: Serapi.Serapi_protocol.answer] [@@deriving sexp] type add_opts = [%import: Serapi.Serapi_protocol.add_opts [@with Sexplib.Conv.sexp_option := sexp_option; ]] [@@deriving sexp] type newdoc_opts = [%import: Serapi.Serapi_protocol.newdoc_opts [@with Stm.interactive_top := Ser_stm.interactive_top; Sexplib.Conv.sexp_list := sexp_list; Sexplib.Conv.sexp_option := sexp_option; ]] [@@deriving sexp] type parse_opt = [%import: Serapi.Serapi_protocol.parse_opt [@with Sexplib.Conv.sexp_option := sexp_option; ]] [@@deriving sexp] type cmd = [%import: Serapi.Serapi_protocol.cmd] [@@deriving sexp] type tagged_cmd = [%import: Serapi.Serapi_protocol.tagged_cmd] [@@deriving sexp] type sentence = Sentence of Tok.t CAst.t list [@@deriving sexp]
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>