Module OpamParserTypes.FullPos

OpamParserTypes transitional module with full position types

type file_name = string

Source file positions

type pos = {
filename : file_name;
start : int * int;
stop : int * int;
}

Full position

type 'a with_pos = {
pelem : 'a;
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 =
| Bool of bool(*

bool atoms

*)
| Int of int(*

int atoms

*)
| String of string(*

string atoms

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

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

*)
| Prefix_relop of relop * value(*

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

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

Logical operators

*)
| Pfxop of pfxop * value(*

Prefix operators

*)
| Ident of string(*

Identifiers

*)
| List of value list with_pos(*

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

*)
| Group of value list with_pos(*

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

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

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

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

Environment variable binding (FOO += "bar")

*)

Base values

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

Section kind (e.g. extra-source)

*)
section_name : string with_pos option;(*

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

*)
section_items : opamfile_item list with_pos;(*

Content of the section

*)
}

An opamfile section

and opamfile_item_kind =
| Section of opamfile_section(*

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

*)
| 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 = {
file_contents : opamfile_item list;(*

Content of the file

*)
file_name : file_name;(*

Name of the disk file this record was loaded from

*)
}

A file is a list of items and the filename