package mopsa

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

Positions and ranges

Positions

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

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

    File name.

    *)
  2. pos_line : int;
    (*

    Line number.

    *)
  3. pos_column : int;
    (*

    Column number.

    *)
}

Position in a file.

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

Comparison function of positions.

val relative_path : string -> string

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

Ranges

==========

type 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.

and 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.

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

Tag a range with a (formatted) annotation.

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

Comparison function of ranges.

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

Range annotations

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

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

Pretty printers

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

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

Innovation. Community. Security.