Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file utilities.ml
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485(**************************************************************************)(* *)(* VSRocq *)(* *)(* Copyright INRIA and contributors *)(* (see version control and README file for authors & dates) *)(* *)(**************************************************************************)(* *)(* This file is distributed under the terms of the MIT License. *)(* See LICENSE file. *)(* *)(**************************************************************************)openTypesletLoglog=Log.mk_log"utilities"letshift_loc~start~offsetloc=let(loc_start,loc_stop)=Loc.unloclocinifloc_start>=startthenLoc.shift_locoffsetoffsetlocelseifloc_stop>startthenLoc.shift_loc0offsetlocelselocletshift_feedback~start~offset(level,oloc,qf,msgasfeedback)=matcholocwith|None->feedback|Someloc->letloc'=shift_loc~start~offsetlocinifloc'==locthenfeedbackelse(level,Someloc',qf,msg)letshift_1qf~start~offsetq=letloc=Quickfix.locqinletloc'=shift_loc~start~offsetlocinifloc'==locthenqelseQuickfix.make~loc:loc'(Quickfix.ppq)letshift_quickfix~start~offsetqf=Option.Smart.map(CList.Smart.map(shift_1qf~start~offset))qfletshift_checking_result~start~offset=function|Success_|Failure((None,_),_,_)asx->x|(Failure((Someloc,e),qf,st))asx->letloc'=shift_loc~start~offsetlocinletqf'=shift_quickfix~start~offsetqfinifloc'==loc&&qf'==qfthenxelseFailure((Someloc',e),qf',st)letdoc_id=ref(-1)letfresh_doc_id()=incrdoc_id;!doc_idletfeedback_pipe_cleanup{rocq_feeder;sel_feedback_queue;sel_cancellation_handle}=Feedback.del_feederrocq_feeder;Queue.clearsel_feedback_queue;Sel.Event.cancelsel_cancellation_handle(** Returns the vernac state after the sentence *)letget_vernac_state(checked:sentence_checking_resultoption)=matchcheckedwith|None->log(fun()->"Cannot find state for get_vernac_state");None|Some(Failure(_,_,None))->log(fun()->"State requested after error with no state");None|Some(SuccessNone)->log(fun()->"State requested in a remotely checked state");None|Some(Success(Somest))|Some(Failure(_,_,Somest))->Somest[%%ifrocq="8.18"||rocq="8.19"]letvernacstate_synterp_parsingx=x.Vernacstate.synterp.Vernacstate.Synterp.parsing[%%else]letvernacstate_synterp_parsingx=Vernacstate.(Synterp.parsingx.synterp)[%%endif]letoption_to_list=function|None->[]|Somex->[x][%%ifrocq="8.18"||rocq="8.19"]letconstrs_of_local_binder=function|Constrexpr.CLocalAssum(_,_,ty)->[ty]|Constrexpr.CLocalDef(_,e,e_opt)->e::option_to_liste_opt|Constrexpr.CLocalPattern_->[][%%else]letconstrs_of_local_binder=function|Constrexpr.CLocalAssum(_,_,_,ty)->[ty]|Constrexpr.CLocalDef(_,_,e,e_opt)->e::option_to_liste_opt|Constrexpr.CLocalPattern_->[][%%endif]