(*********************************************************************************)
(*                Chamo                                                          *)
(*                                                                               *)
(*    Copyright (C) 2003-2021 Institut National de Recherche en Informatique     *)
(*    et en Automatique. All rights reserved.                                    *)
(*                                                                               *)
(*    This program is free software; you can redistribute it and/or modify       *)
(*    it under the terms of the GNU Lesser General Public License version        *)
(*    3 as published by the Free Software Foundation.                            *)
(*                                                                               *)
(*    This program is distributed in the hope that it will be useful,            *)
(*    but WITHOUT ANY WARRANTY; without even the implied warranty of             *)
(*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *)
(*    GNU General Public License for more details.                               *)
(*                                                                               *)
(*    You should have received a copy of the GNU General Public License          *)
(*    along with this program; if not, write to the Free Software                *)
(*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                   *)
(*    02111-1307  USA                                                            *)
(*                                                                               *)
(*    Contact: Maxence.Guesdon@inria.fr                                          *)
(*                                                                               *)
(*********************************************************************************)

(** Expansion of words in sourceviews. *)

type expand_context = {
  buffer : string;
  mutable pos : int;
  searched_rex : Pcre.regexp;
  searched_pattern : string;
  mutable prev_prop : string * int;
  mutable prev_inserted : string option;
  mutable already_proposed : string list;
}
val context : expand_context option ref
val create_context : string -> int -> string -> Pcre.regexp -> expand_context
val search_in_buffer :
  bool ->
  Sourceview.my_buffer ->
  start:int -> stop:int -> Pcre.regexp -> int * string
val get_next_proposition_in_buffer : expand_context -> string -> int * string
val get_next_buffer_in_history : string -> string option
val get_next_proposition : expand_context -> (bool * string) option
val get_pattern :
  Sourceview.sourceview -> int -> string * Pcre.regexp
val expand : Sourceview.sourceview -> string array -> unit
