package ez_opam_file

  1. Overview
  2. Docs

OpamParserTypes transitional module with full position types

type file_name = string

Source file positions

type pos = {
  1. filename : file_name;
  2. start : int * int;
  3. stop : int * int;
}

Full position

type 'a with_pos = {
  1. pelem : 'a;
  2. pos : pos;
}

with_pos type, used for all units, embedding the element pelem ans its position pos

type relop_kind = relop
type relop = relop_kind with_pos
type logop_kind = logop
type logop = logop_kind with_pos
type pfxop_kind = pfxop
type pfxop = pfxop_kind with_pos
type env_update_op_kind = env_update_op
type env_update_op = env_update_op_kind with_pos
type value_kind =
  1. | Bool of bool
    (*

    bool atoms

    *)
  2. | Int of int
    (*

    int atoms

    *)
  3. | String of string
    (*

    string atoms

    *)
  4. | Relop of relop * value * value
    (*

    Relational operators with two values (e.g. os != "win32")

    *)
  5. | Prefix_relop of relop * value
    (*

    Relational operators in prefix position (e.g. < "4.07.0")

    *)
  6. | Logop of logop * value * value
    (*

    Logical operators

    *)
  7. | Pfxop of pfxop * value
    (*

    Prefix operators

    *)
  8. | Ident of string
    (*

    Identifiers

    *)
  9. | List of value list with_pos
    (*

    Lists of values ([x1 x2 ... x3])

    *)
  10. | Group of value list with_pos
    (*

    Groups of values ((x1 x2 ... x3))

    *)
  11. | Option of value * value list with_pos
    (*

    Value with optional list (x1 {x2 x3 x4})

    *)
  12. | Env_binding of value * env_update_op * value
    (*

    Environment variable binding (FOO += "bar")

    *)

Base values

and value = value_kind with_pos
type opamfile_section = {
  1. section_kind : string with_pos;
    (*

    Section kind (e.g. extra-source)

    *)
  2. section_name : string with_pos option;
    (*

    Section name (e.g. "myfork.patch")

    *)
  3. section_items : opamfile_item list with_pos;
    (*

    Content of the section

    *)
}

An opamfile section

and opamfile_item_kind =
  1. | Section of opamfile_section
    (*

    e.g. kind ["name"] { ... }

    *)
  2. | Variable of string with_pos * value
    (*

    e.g. opam-version: "2.0"

    *)

An opamfile is composed of sections and variable definitions

and opamfile_item = opamfile_item_kind with_pos
type opamfile = {
  1. file_contents : opamfile_item list;
    (*

    Content of the file

    *)
  2. file_name : file_name;
    (*

    Name of the disk file this record was loaded from

    *)
}

A file is a list of items and the filename