Module Document
type 'a documenttype id= Stateid.t
val create : unit -> 'a documentval tip : 'a document -> idThe last sentence.
- raises Invalid_argument
if tip has no id.
@raise Empty
val tip_data : 'a document -> 'aThe last sentence.
- raises Empty
val push : 'a document -> 'a -> unitAdd a sentence on the top (with no state_id)
val pop : 'a document -> 'aRemove the tip setence.
- raises Empty
val cut_at : 'a document -> id -> 'a listcut_at d idcuts the document atidthat is the new tip. Returns the list of sentences that were cut.- raises Not_found
val find_id : 'a document -> (id -> 'a -> bool) -> id * boolreturns the id of the topmost sentence validating the predicate and a boolean that is true if one needs to unfocus the document to access such sentence.
- raises Not_found
val find : 'a document -> (bool -> id option -> 'a -> bool) -> 'alook for a sentence validating the predicate. The boolean is true if the sentence is in the zone currently focused.
- raises Not_found
val find_map : 'a document -> (bool -> id option -> 'a -> 'b option) -> 'bval focus : 'a document -> cond_top:(id -> 'a -> bool) -> cond_bot:(id -> 'a -> bool) -> unitAfter
focus s c1 c2the top ofsis the topmost elementxsuch thatc1 xistrueand the bottom is the first elementyfollowingxsuch thatc2 yistrue.- raises Invalid_argument
if there is no such
xandyor already focused
val unfocus : 'a document -> unitUndoes a
focus.- raises Invalid_argument
"CStack.unfocus" if the stack is not focused
val focused : 'a document -> boolIs the document focused
val is_empty : 'a document -> boolNo sentences at all
val before_tip : 'a document -> id * boolreturns the 1 to-last sentence, and true if we need to unfocus to reach it.
- raises Not_found
val fold_all : 'a document -> 'c -> ('c -> bool -> id option -> 'a -> 'c) -> 'cFolds over the whole document starting from the topmost (maybe unfocused) sentence.
val context : 'a document -> (id * 'a) list * (id * 'a) listReturns (top,bot) such that the document is morally (top @ s @ bot) where s is the focused part.
- raises Invalid_argument
class type 'a signals = object ... end