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

4
5
6
7
type source = 
    [ `None | `File of string | `Stream | `String of string 
    | `Buffer of Buffer.t ]

8
type loc = source * int * int
9
10
11
type precise = [ `Full | `Char of int ]

exception Location of loc * precise * exn
12
exception Generic of string
13

14
val noloc:loc
15
val nopos:int * int
16

17
18
val merge_loc: loc -> loc -> loc

19
val raise_loc: int -> int -> exn -> 'a
20
21
22
val raise_generic: string -> 'a
val raise_loc_generic: loc -> string -> 'a

23
24
val push_source: source -> unit
val pop_source: unit -> unit
25

26
27
val current_dir : unit -> string

28
29
val set_viewport: Html.t -> unit
val get_viewport: unit -> Html.t
30

31
(*
32
val protect: Format.formatter -> (Format.formatter -> unit) -> unit
33
*)
34

35
val print_loc: Format.formatter -> loc * precise -> unit
36
37
val dump_loc: loc * precise -> unit
val html_hilight: loc * precise -> unit
38
39

type 'a located = { loc : loc; descr : 'a }
40
41
42
val mk: int * int -> 'a -> 'a located
val mk_loc: loc -> 'a -> 'a located
val mknoloc: 'a -> 'a located
43

44
45
val loc_of_pos : int * int -> loc

46
47
48
49
50

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