Frama-C API - Fileloc
This module handle locations in a source file. Fileloc.t is a Frama-C datatype, and comes with usual compare, equal, hash and pretty functions.
comparefirst compares the starting position of the location then - if they are equal - compares the ending position.hashonly hashes the first position.
val pp : Ppx_deriving_runtime.Format.formatter -> t -> Ppx_deriving_runtime.unitval show : t -> Ppx_deriving_runtime.stringinclude Datatype.S_with_collections with type t := t
include Datatype.S with type t := t
include Datatype.S_no_copy with type t := t
include Datatype.Ty with type t := t
val packed_descr : Structural_descr.packPacked version of the descriptor.
val reprs : t listList of representants of the descriptor.
val hash : t -> intHash function: same spec than Hashtbl.hash.
val mem_project : (Project_skeleton.t -> bool) -> t -> boolmem_project f x must return true iff there is a value p of type Project.t in x such that f p returns true.
module Set : Datatype.Set with type elt = tmodule Map : Datatype.Map with type key = tmodule Hashtbl : Datatype.Hashtbl with type key = tval unknown : tSpecial representation of an unknown location.
Make a new location for a generated input. The generator name is given as a string. If the location is provided, it is copied (except for its origin), else it is unknown.
Pretty printing
val pretty : Stdlib.Format.formatter -> t -> unitPretty prints a locaton in a short format file:<line1>-<line2>:<char1>-<char2>, with variants depending on if both positions are in the same file/line/column. Generated locations are printed inside a tag <generated by <generator> from <loc>>
val pretty_long : t Pretty_utils.formatterPretty prints a locaton in a long format "file", lines <line1>-<line2>, characters <char1>-<char2>, with variants depending on if both positions are in the same file/line/column. Generated locations are printed as such generated by <generator> from <loc>.
val pretty_long_with_inclusions : t Pretty_utils.formatterSame as pretty_long but also prints the list of inclusion.
val pretty_debug : t Pretty_utils.formatterPretty-prints the ocaml internal representation of a location, for debug purposes.
Conversion from/to Lexing.position
val of_lexing_loc : (Stdlib.Lexing.position * Stdlib.Lexing.position) -> tConvert a pair of Lexing.position to a Fileloc.t.
val to_lexing_loc : t -> Stdlib.Lexing.position * Stdlib.Lexing.positionConvert a pair of Fileloc.t to a Lexing.position.
Accessors
val line : t -> intGet the first line of the location.
val path : t -> Filepath.tGet the file path of the location.
val is_empty : t -> boolis_empty loc returns true if the first position is empty according to Filepos.is_empty.
Datatype with comparison/hash on original source positions
module Original : Datatype.S_with_collections with type t = tThis module provides an alternative datatype where only original location are considered for compare, equal and hash. See Filepos.origin.Original.
