Dm.DocumentSourceThis file defines operations on the content of a document (text, parsing of sentences, scheduling).
The document gathers the text, which is partially validated (parsed into sentences
type outline_element = {id : Types.sentence_id;name : string;type_ : proof_block_type;statement : string;proof : proof_step list;range : Lsp.Types.Range.t;}type parsing_end_info = {unchanged_id : Types.sentence_id option;invalid_ids : Types.sentence_id_set;previous_document : document;parsed_document : document;}create_document init_synterp_state text creates a fresh document with content defined by text under init_synterp_state.
validate_document doc triggers the parsing of the document line by line without launching any execution.
handle_event dpc ev handles a parsing event for the document. One parsing event parses one line and prepares the next parsing event. Finally once the full parsing is done, the final event returs the id of the bottomost sentence of the prefix which has not changed since the previous validation as well as the set of invalidated sentences.
type parsed_ast = {ast : Synterp.vernac_control_entry;classification : Vernacextend.vernac_classification;tokens : Tok.t list;}type parsing_error = {start : int;stop : int;msg : Pp.t Loc.located;qf : Types.Quickfix.t list option;str : string;}parse_errors doc returns the list of sentences which failed to parse (see validate_document) together with their error message
parse_errors doc returns the list of sentences which failed to parse (see validate_document) together with their error message
apply_text_edits doc edits updates the text of doc with edits. The new text is not parsed or executed.
apply_text_edits doc edits updates the text of doc with edits. The new text is not parsed or executed.
apply_text_edits doc edits updates the text of doc with edits. The new text is not parsed or executed.
type sentence = {parsing_start : int;start : int;stop : int;synterp_state : Vernacstate.Synterp.t;scheduler_state_before : Scheduler.state;scheduler_state_after : Scheduler.state;ast : sentence_state;id : Types.sentence_id;messages : Types.feedback_message list;checked : Types.sentence_checking_result option;}find_sentence doc loc finds the sentence containing the loc
find_sentence_before doc loc finds the last sentence before the loc
find_sentence_before_pos doc pos finds the sentence before the pos
find_sentence_after doc loc finds the first sentence after the loc
find_sentence_after_pos doc pos finds the first sentence after the pos
find_next_qed parsed loc finds the next proof end
get_first_sentence doc returns the first parsed sentence
get_last_sentence doc returns the last parsed sentence
is_sentence_above doc id1 id2 check is id1 is above id2
has_sentence doc id tells if id is in the document
range_of_id doc id returns a Range object coressponding to the sentence id given in argument
range_of_id_with_blank_space doc id returns a Range object coressponding to the sentence id given in argument but with the white spaces before (until the previous sentence)
all_feedback doc returns all sentences with a feedback
feedback doc id returns all feedback messages for id
val all_checking_errors :
document ->
(Types.sentence_id * (Loc.t option * Pp.t * Types.Quickfix.t list option))
listall_checking_errors doc returns all sentences that were checked and resulted in an error
val error :
document ->
Types.sentence_id ->
(Loc.t option * Pp.t * Types.Quickfix.t list option) optionerror doc id returns the checking error for id, if any
append_feedback doc id msg appends msg to existing messages on id
shift_feedbacks_and_checking_errors ~start ~stop doc shifts all messages past start by offset
val update_checked :
document ->
(Types.sentence_id * Types.sentence_checking_result) ->
documentupdate_checked doc id v updates the checked field of sentence id
remove_checked doc id marks id as unchecked
is_checked doc id tells if id is checked