1Location(3)                        OCamldoc                        Location(3)
2
3
4

NAME

6       Location  - Source code locations (ranges of positions), used in parse‐
7       tree.
8

Module

10       Module   Location
11

Documentation

13       Module Location
14        : sig end
15
16
17       Source code locations (ranges of positions), used in parsetree.
18
19
20
21
22
23       type t = {
24        loc_start : Lexing.position ;
25        loc_end : Lexing.position ;
26        loc_ghost : bool ;
27        }
28
29
30
31
32
33
34       === Note on the use of Lexing.position in this module.  If pos_fname  =
35       ,  then  use  !input_name instead.  If pos_lnum = -1, then pos_bol = 0.
36       Use pos_cnum and re-parse the file to get the line and  character  num‐
37       bers.  Else all fields are correct. ===
38
39
40       val none : t
41
42       An arbitrary value of type t ; describes an empty ghost range.
43
44
45
46       val in_file : string -> t
47
48       Return an empty ghost range located in a given file.
49
50
51
52       val init : Lexing.lexbuf -> string -> unit
53
54       Set  the file name and line number of the lexbuf to be the start of the
55       named file.
56
57
58
59       val curr : Lexing.lexbuf -> t
60
61       Get the location of the current token from the lexbuf .
62
63
64
65       val symbol_rloc : unit -> t
66
67
68
69
70       val symbol_gloc : unit -> t
71
72
73
74
75       val rhs_loc : int -> t
76
77
78       rhs_loc n returns the location of the symbol at position n  ,  starting
79       at 1, in the current parser rule.
80
81
82
83       val input_name : string Pervasives.ref
84
85
86
87
88       val input_lexbuf : Lexing.lexbuf option Pervasives.ref
89
90
91
92
93       val get_pos_info : Lexing.position -> string * int * int
94
95
96
97
98       val print_loc : Format.formatter -> t -> unit
99
100
101
102
103       val print_error : Format.formatter -> t -> unit
104
105
106
107
108       val print_error_cur_file : Format.formatter -> unit -> unit
109
110
111
112
113       val print_warning : t -> Format.formatter -> Warnings.t -> unit
114
115
116
117
118       val formatter_for_warnings : Format.formatter Pervasives.ref
119
120
121
122
123       val prerr_warning : t -> Warnings.t -> unit
124
125
126
127
128       val echo_eof : unit -> unit
129
130
131
132
133       val reset : unit -> unit
134
135
136
137
138       val  warning_printer  :  (t  -> Format.formatter -> Warnings.t -> unit)
139       Pervasives.ref
140
141       Hook for intercepting warnings.
142
143
144
145       val default_warning_printer : t -> Format.formatter  ->  Warnings.t  ->
146       unit
147
148       Original warning printer for use in hooks.
149
150
151
152       val highlight_locations : Format.formatter -> t list -> bool
153
154
155
156       type 'a loc = {
157        txt : 'a ;
158        loc : t ;
159        }
160
161
162
163
164
165       val mknoloc : 'a -> 'a loc
166
167
168
169
170       val mkloc : 'a -> t -> 'a loc
171
172
173
174
175       val print : Format.formatter -> t -> unit
176
177
178
179
180       val print_compact : Format.formatter -> t -> unit
181
182
183
184
185       val print_filename : Format.formatter -> string -> unit
186
187
188
189
190       val absolute_path : string -> string
191
192
193
194
195       val show_filename : string -> string
196
197       In  -absname  mode, return the absolute path for this filename.  Other‐
198       wise, returns the filename unchanged.
199
200
201
202       val absname : bool Pervasives.ref
203
204
205
206       type error = {
207        loc : t ;
208        msg : string ;
209        sub : error list ;
210        if_highlight : string ;
211        }
212
213
214
215
216
217       exception Error of error
218
219
220
221
222
223       val print_error_prefix : Format.formatter -> unit -> unit
224
225
226
227
228       val error : ?loc:t -> ?sub:error list -> ?if_highlight:string -> string
229       -> error
230
231
232
233
234       val  errorf : ?loc:t -> ?sub:error list -> ?if_highlight:string -> ('a,
235       Format.formatter, unit, error) Pervasives.format4 -> 'a
236
237
238
239
240       val raise_errorf : ?loc:t -> ?sub:error list -> ?if_highlight:string ->
241       ('a, Format.formatter, unit, 'b) Pervasives.format4 -> 'a
242
243
244
245
246       val  error_of_printer  : t -> (Format.formatter -> 'a -> unit) -> 'a ->
247       error
248
249
250
251
252       val error_of_printer_file : (Format.formatter -> 'a -> unit) ->  'a  ->
253       error
254
255
256
257
258       val error_of_exn : exn -> error option
259
260
261
262
263       val register_error_of_exn : (exn -> error option) -> unit
264
265
266
267
268       val report_error : Format.formatter -> error -> unit
269
270
271
272
273       val error_reporter : (Format.formatter -> error -> unit) Pervasives.ref
274
275       Hook for intercepting error reports.
276
277
278
279       val default_error_reporter : Format.formatter -> error -> unit
280
281       Original error reporter for use in hooks.
282
283
284
285       val report_exception : Format.formatter -> exn -> unit
286
287
288
289
290
291
2922018-04-14                          source:                        Location(3)
Impressum