(************************************************************************) (* * The Coq Proof Assistant / The Coq Development Team *) (* v * INRIA, CNRS and contributors - Copyright 1999-2018 *) (* (* This shouldn't happen frequently. Either: - we are at eof, with indeed an unfinished sentence. - we have just inserted an opening of comment or string. - the inserted text ends with a "." that interacts with the "." found by [grab_ending_dot] to form a non-ending "..". In any case, we retag up to eof, since this isn't that costly. *) if not stop#is_end then let eoi = buffer#get_iter_at_mark (`NAME "stop_of_input") in try split_slice_lax buffer start eoi with Coq_lex.Unterminated -> () with StartError -> buffer#apply_tag ~start:soi ~stop:soi#forward_char Tags.Script.error let tag_all buffer = let soi = buffer#get_iter_at_mark (`NAME "start_of_input") in let eoi = buffer#get_iter_at_mark (`NAME "stop_of_input") in try split_slice_lax buffer soi eoi with Coq_lex.Unterminated -> () (** Search a sentence around some position *) let find buffer (start:GText.iter) = let soi = buffer#get_iter_at_mark (`NAME "start_of_input") in try let start = grab_sentence_start start soi in let stop = grab_sentence_stop start in (* Is this phrase non-empty and complete ? *) if stop#compare start > 0 && is_sentence_end stop#backward_char then Some (start,stop) else None with StartError -> None