package kappa-library

  1. Overview
  2. Docs
On This Page
  1. I/O
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Kappa_data_structures.LocSource

Module for type Loc.t annotating structured data with the line range * in a file which was used to define it

Sourcetype position = {
  1. chr : int;
  2. line : int;
}
Sourcetype t = {
  1. file : string;
  2. from_position : position;
  3. to_position : position;
}
Sourcetype 'a annoted = 'a * t
Sourceval v : 'a annoted -> 'a

Extract value from Loc.annoted

Sourceval get_annot : 'a annoted -> t

Extract annotation from Loc.annoted

Sourceval copy_annot : 'b annoted -> 'a -> 'a annoted

Create annoted variable with same annotation as existing variable

Sourceval map_annot : ('a -> 'b) -> 'a annoted -> 'b annoted

Apply operation on variable and keep annotation

Sourceval dummy : t
Sourceval annot_with_dummy : 'a -> 'a annoted
Sourceval is_annoted_with_dummy : 'a annoted -> bool
Sourceval merge : t -> t -> t

merge b e creates the range from beginning of b to the end of e (filename must match)

Sourceval is_included_in : string -> position -> t -> bool

I/O

Sourceval to_string : t -> string
Sourceval print : Format.formatter -> t -> unit
Sourceval print_annoted : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a annoted -> unit
Sourceval annoted_of_yojson : ?filenames:string array -> (Yojson.Basic.t -> 'a) -> Yojson.Basic.t -> 'a annoted
Sourceval yojson_of_annoted : ?filenames:int Kappa_data_structures.Mods.StringMap.t -> ('a -> Yojson.Basic.t) -> 'a annoted -> Yojson.Basic.t
Sourceval write_position : Buffer.t -> position -> unit
Sourceval write_range : Buffer.t -> t -> unit

Output a JSON value of type t.

Sourceval string_of_range : ?len:int -> t -> string

Serialize a value of type t into a JSON string.

  • parameter len

    specifies the initial length of the buffer used internally. Default: 1024.

Input JSON data of type t.

Sourceval range_of_string : string -> t

Deserialize JSON data of type t.

Annoted yojson helpers

Sourceval string_annoted_to_json : filenames:int Kappa_data_structures.Mods.StringMap.t -> string annoted -> Yojson.Basic.t
Sourceval string_annoted_of_json : filenames:string array -> Yojson.Basic.t -> string annoted
Sourceval string_option_annoted_to_json : filenames:int Kappa_data_structures.Mods.StringMap.t -> string option annoted -> Yojson.Basic.t
Sourceval string_option_annoted_of_json : filenames:string array -> Yojson.Basic.t -> string option annoted
OCaml

Innovation. Community. Security.