package mopsa

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Utils_core.LocationSource

Positions and ranges

Positions

=============

Sourcetype pos = {
  1. pos_file : string;
    (*

    File name.

    *)
  2. pos_line : int;
    (*

    Line number.

    *)
  3. pos_column : int;
    (*

    Column number.

    *)
}

Position in a file.

Sourceval get_pos_file : pos -> string
Sourceval get_pos_line : pos -> int
Sourceval get_pos_column : pos -> int
Sourceval mk_pos : string -> int -> int -> pos
Sourceval compare_pos : pos -> pos -> int

Comparison function of positions.

Sourceval relative_path : string -> string

Return the relative path of `file` w.r.t. the current working directory

Ranges

==========

Sourcetype range =
  1. | R_program of string list
    (*

    list of source files

    *)
  2. | R_orig of pos * pos
    (*

    end position

    *)
  3. | R_fresh of int
    (*

    non-original fresh range with unique id

    *)
  4. | R_tagged of range_tag * range
    (*

    Tagged range with an annotation

    *)

Location range of AST nodes.

Sourceand range_tag =
  1. | String_tag of string
  2. | Range_tag of range

Range tags can be used to annotate AST nodes added by the abstract domains that are not textually present in the source files.

Sourceval mk_tagged_range : range_tag -> range -> range
Sourceval mk_string_tag : ('a, Stdlib.Format.formatter, unit, range_tag) Stdlib.format4 -> 'a
Sourceval mk_range_tag : range -> range_tag
Sourceval mk_range_tagged_range : range -> range -> range
Sourceval tag_range : range -> ('a, Stdlib.Format.formatter, unit, range) Stdlib.format4 -> 'a

Tag a range with a (formatted) annotation.

Sourceval mk_orig_range : pos -> pos -> range
Sourceval fresh_range_counter : int Stdlib.ref
Sourceval mk_fresh_range : unit -> range
Sourceval mk_program_range : string list -> range
Sourceval untag_range : range -> range
Sourceval map_tag : (range -> range) -> range -> range
Sourceval get_range_start : range -> pos
Sourceval get_range_end : range -> pos
Sourceval set_range_start : range -> pos -> range
Sourceval set_range_end : range -> pos -> range
Sourceval get_range_file : range -> string
Sourceval get_range_relative_file : range -> string
Sourceval get_range_line : range -> int
Sourceval get_range_column : range -> int
Sourceval is_orig_range : range -> bool
Sourceval is_program_range : range -> bool
Sourceval match_range_file : string -> range -> bool
Sourceval match_range_line : int -> range -> bool
Sourceval from_lexing_pos : Stdlib.Lexing.position -> pos
Sourceval from_lexing_range : Stdlib.Lexing.position -> Stdlib.Lexing.position -> range
Sourceval compare_range : range -> range -> int

Comparison function of ranges.

Sourceval compare_range_tag : range_tag -> range_tag -> int
Sourceval subset_range : range -> range -> bool

Range annotations

=====================

Sourcetype 'a with_range = {
  1. content : 'a;
  2. range : range;
}
Sourceval with_range : 'a -> range -> 'a with_range
Sourceval get_content : 'a with_range -> 'a
Sourceval get_range : 'a with_range -> range
Sourceval bind_range : 'a with_range -> ?range:range -> ('a -> 'b) -> 'b with_range
Sourceval bind_pair_range : 'a with_range -> ('a -> 'b * 'c) -> 'b with_range * 'c
Sourceval compare_with_range : ('a -> 'b -> int) -> 'a with_range -> 'b with_range -> int

Pretty printers

===================

Sourceval pp_position : Stdlib.Format.formatter -> pos -> unit
Sourceval pp_relative_position : Stdlib.Format.formatter -> pos -> unit
Sourceval pp_range : Stdlib.Format.formatter -> range -> unit
Sourceval pp_relative_range : Stdlib.Format.formatter -> range -> unit
OCaml

Innovation. Community. Security.