location.mli 1.17 KB
Newer Older
1 2
(* Locations in source file,
   and presentation of results and errors *)
3

4 5
type source = [ `None | `File of string | `Stream | `String of string ]
type loc = source * int * int
6 7 8
type precise = [ `Full | `Char of int ]

exception Location of loc * precise * exn
9 10
exception Generic of string
val noloc:loc
11
val nopos:int * int
12

13 14
val merge_loc: loc -> loc -> loc

15
val raise_loc: int -> int -> exn -> 'a
16 17 18
val raise_generic: string -> 'a
val raise_loc_generic: loc -> string -> 'a

19 20
val push_source: source -> unit
val pop_source: unit -> unit
21

22 23
val current_dir : unit -> string

24 25
val set_viewport: Html.t -> unit
val get_viewport: unit -> Html.t
26

27
(*
28
val protect: Format.formatter -> (Format.formatter -> unit) -> unit
29
*)
30

31
val print_loc: Format.formatter -> loc * precise -> unit
32 33
val dump_loc: loc * precise -> unit
val html_hilight: loc * precise -> unit
34 35

type 'a located = { loc : loc; descr : 'a }
36 37 38
val mk: int * int -> 'a -> 'a located
val mk_loc: loc -> 'a -> 'a located
val mknoloc: 'a -> 'a located
39

40 41
val loc_of_pos : int * int -> loc

42 43 44 45 46

(* Are we working in a protected environement (web prototype ...) ? *)
val set_protected : bool -> unit
val is_protected : unit -> bool
val protect_op : string -> unit