.TH "Location" 3o source: 2017-09-14 OCamldoc "OCaml library" .SH NAME Location \- Source code locations (ranges of positions), used in parsetree. .SH Module Module Location .SH Documentation .sp Module .BI "Location" : .B sig end .sp Source code locations (ranges of positions), used in parsetree\&. .sp .sp .sp .I type t = { loc_start : .B Lexing.position ; loc_end : .B Lexing.position ; loc_ghost : .B bool ; } .sp .sp .PP .B === Note on the use of Lexing\&.position in this module\&. .B If pos_fname = "", then use !input_name instead\&. .B If pos_lnum = \-1, then pos_bol = 0\&. Use pos_cnum and .B re\-parse the file to get the line and character numbers\&. .B Else all fields are correct\&. === .PP .I val none : .B t .sp An arbitrary value of type .B t ; describes an empty ghost range\&. .sp .I val in_file : .B string -> t .sp Return an empty ghost range located in a given file\&. .sp .I val init : .B Lexing.lexbuf -> string -> unit .sp Set the file name and line number of the .B lexbuf to be the start of the named file\&. .sp .I val curr : .B Lexing.lexbuf -> t .sp Get the location of the current token from the .B lexbuf \&. .sp .I val symbol_rloc : .B unit -> t .sp .sp .I val symbol_gloc : .B unit -> t .sp .sp .I val rhs_loc : .B int -> t .sp .B rhs_loc n returns the location of the symbol at position .B n , starting at 1, in the current parser rule\&. .sp .I val input_name : .B string Pervasives.ref .sp .sp .I val input_lexbuf : .B Lexing.lexbuf option Pervasives.ref .sp .sp .I val get_pos_info : .B Lexing.position -> string * int * int .sp .sp .I val print_loc : .B Format.formatter -> t -> unit .sp .sp .I val print_error : .B Format.formatter -> t -> unit .sp .sp .I val print_error_cur_file : .B Format.formatter -> unit -> unit .sp .sp .I val print_warning : .B t -> Format.formatter -> Warnings.t -> unit .sp .sp .I val formatter_for_warnings : .B Format.formatter Pervasives.ref .sp .sp .I val prerr_warning : .B t -> Warnings.t -> unit .sp .sp .I val echo_eof : .B unit -> unit .sp .sp .I val reset : .B unit -> unit .sp .sp .I val warning_printer : .B (t -> Format.formatter -> Warnings.t -> unit) Pervasives.ref .sp Hook for intercepting warnings\&. .sp .I val default_warning_printer : .B t -> Format.formatter -> Warnings.t -> unit .sp Original warning printer for use in hooks\&. .sp .I val highlight_locations : .B Format.formatter -> t list -> bool .sp .sp .I type .B 'a .I loc = { txt : .B 'a ; loc : .B t ; } .sp .sp .I val mknoloc : .B 'a -> 'a loc .sp .sp .I val mkloc : .B 'a -> t -> 'a loc .sp .sp .I val print : .B Format.formatter -> t -> unit .sp .sp .I val print_compact : .B Format.formatter -> t -> unit .sp .sp .I val print_filename : .B Format.formatter -> string -> unit .sp .sp .I val absolute_path : .B string -> string .sp .sp .I val show_filename : .B string -> string .sp In \-absname mode, return the absolute path for this filename\&. Otherwise, returns the filename unchanged\&. .sp .I val absname : .B bool Pervasives.ref .sp .sp .I type error = { loc : .B t ; msg : .B string ; sub : .B error list ; if_highlight : .B string ; } .sp .sp .I exception Error .B of .B error .sp .sp .I val print_error_prefix : .B Format.formatter -> unit -> unit .sp .sp .I val error : .B ?loc:t -> .B ?sub:error list -> ?if_highlight:string -> string -> error .sp .sp .I val errorf : .B ?loc:t -> .B ?sub:error list -> .B ?if_highlight:string -> .B ('a, Format.formatter, unit, error) Pervasives.format4 -> 'a .sp .sp .I val raise_errorf : .B ?loc:t -> .B ?sub:error list -> .B ?if_highlight:string -> .B ('a, Format.formatter, unit, 'b) Pervasives.format4 -> 'a .sp .sp .I val error_of_printer : .B t -> (Format.formatter -> 'a -> unit) -> 'a -> error .sp .sp .I val error_of_printer_file : .B (Format.formatter -> 'a -> unit) -> 'a -> error .sp .sp .I val error_of_exn : .B exn -> error option .sp .sp .I val register_error_of_exn : .B (exn -> error option) -> unit .sp .sp .I val report_error : .B Format.formatter -> error -> unit .sp .sp .I val error_reporter : .B (Format.formatter -> error -> unit) Pervasives.ref .sp Hook for intercepting error reports\&. .sp .I val default_error_reporter : .B Format.formatter -> error -> unit .sp Original error reporter for use in hooks\&. .sp .I val report_exception : .B Format.formatter -> exn -> unit .sp .sp