123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116(*************************************************************************)(* Copyright 2015-2019 MINES ParisTech -- Dual License LGPL 2.1+ / GPL3+ *)(* Copyright 2019-2024 Inria -- Dual License LGPL 2.1+ / GPL3+ *)(* Copyright 2024-2025 Emilio J. Gallego Arias -- LGPL 2.1+ / GPL3+ *)(* Copyright 2025 CNRS -- LGPL 2.1+ / GPL3+ *)(* Written by: Emilio J. Gallego Arias & coq-lsp contributors *)(*************************************************************************)(* Rocq Language Server Protocol: Rocq arguments API *)(*************************************************************************)openCmdliner(* [Boot.Util.relocate] is too specific to rocq.exe for it to work, EJGA: this
needs likely more attention in our case, but OMMV *)letcoqlib_dyn=Coq_config.coqlib(****************************************************************************)(* Common Coq command-line arguments *)letcoqlib=letdoc="Load Coq.Init.Prelude from $(docv); theories and user-contrib should live \
there."inArg.(value&optstringcoqlib_dyn&info["coqlib"]~docv:"COQLIB"~doc)letfindlib_config=letdoc="Override findlib's config file"inArg.(value&opt(somestring)None&info["findlib_config"]~docv:"OCAMLFIND_CONF"~doc)letocamlpath=letdoc="Extra Paths to OCaml's libraries"inArg.(value&opt(liststring)[]&info["ocamlpath"]~docv:"OCAMLPATH"~doc)letcoq_lp_conv~implicit(unix_path,lp)={Loadpath.coq_path=Libnames.dirpath_of_stringlp;unix_path;implicit;has_ml=false;recursive=true}letrload_paths:Loadpath.vo_pathlistTerm.t=letdoc="Bind a logical loadpath LP to a directory DIR and implicitly open its \
namespace."inTerm.(constList.(map(coq_lp_conv~implicit:true))$Arg.(value&opt_all(pairdirstring)[]&info["R";"rec-load-path"]~docv:"DIR,LP"~doc))letqload_paths:Loadpath.vo_pathlistTerm.t=letdoc="Bind a logical loadpath LP to a directory DIR"inTerm.(constList.(map(coq_lp_conv~implicit:false))$Arg.(value&opt_all(pairdirstring)[]&info["Q";"load-path"]~docv:"DIR,LP"~doc))letdebug:boolTerm.t=letdoc="Enable debug mode"inArg.(value&flag&info["debug"]~doc)letbt=letdoc="Enable backtraces"inCmdliner.Arg.(value&flag&info["bt"]~doc)letri_from:(stringoption*string)listTerm.t=letdoc="FROM Require Import LIBRARY before creating the document, à la From Coq \
Require Import Prelude"inTerm.(const(List.map(fun(x,y)->(Somex,y)))$Arg.(value&opt_all(pairstringstring)[]&info["rifrom";"require-import-from"]~docv:"FROM,LIBRARY"~doc))letint_backend=letdocv="BACKEND"inletbackends=[("Coq",Limits.Coq);("Mp",Limits.Mp)]inletbackends_str="either 'Mp', for memprof-limits token-based interruption,\n\
\ or 'Coq', for Coq's polling mode (unreliable). The 'Mp' backend is only \
supported in OCaml 4.x series."inletdoc=Printf.sprintf"Select Interruption Backend, if absent, the best available for your \
OCaml version will be selected. %s is %s"docvbackends_strinletabsent="'Mp' for OCaml 4.x, 'Coq' for OCaml 5.x"inArg.(value&opt(some(enumbackends))None&info["int_backend"]~docv~doc~absent)letroots:stringlistTerm.t=letdoc="Workspace(s) root(s)"inArg.(value&opt_allstring[]&info["root"]~docv:"ROOTS"~doc)letcoq_diags_level:intTerm.t=letdoc="Controls whether Coq Info and Notice message appear in diagnostics.\n\
\ 0 = None; 1 = Notices, 2 = Notices and Info"inArg.(value&optint0&info["diags_level"]~docv:"DIAGS_LEVEL"~doc)