12345678910111213141516171819202122232425262728293031323334353637383940414243444546(************************************************************************)(* * 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 Language Server Protocol *)(* Copyright 2019 MINES ParisTech -- Dual License LGPL 2.1 / GPL3+ *)(* Copyright 2019-2022 Inria -- Dual License LGPL 2.1 / GPL3+ *)(* Written by: Emilio J. Gallego Arias *)(************************************************************************)letcoq_interp~intern~stcmd=letst=State.to_coqstinletcmd=Ast.to_coqcmdinVernacinterp.interp~intern~stcmd|>State.of_coqletinterp~token~intern~stcmd=Protect.eval~tokencmd~f:(coq_interp~intern~st)moduleRequire=struct(* We could improve this Coq upstream by making the API a bit more
orthogonal *)letinterp~intern~st_files{Ast.Require.from;export;mods;loc=_;attrs;control}=let()=Vernacstate.unfreeze_full_state(State.to_coqst)inletfn()=Vernacentries.vernac_require~internfromexportmodsin(* Check generic attributes *)letfn()=Synterp.with_generic_atts~check:trueattrs(fun~atts->(* Fail if attributes are not empty *)Attributes.unsupported_attributesatts;fn())in(* Execute control commands *)let()=Utils.with_control~fn~control~stinVernacstate.freeze_full_state()|>State.of_coqletinterp~token~intern~stfilescmd=Protect.eval~token~f:(interp~intern~stfiles)cmdend