123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138# 1 "src/ez_opam_file/v1.new.ml"(**************************************************************************)(* *)(* Copyright (c) 2020 OCamlPro SAS & Origin Labs SAS *)(* *)(* All rights reserved. *)(* This file is distributed under the terms of the GNU Lesser General *)(* Public License version 2.1, with the special exception on linking *)(* described in the LICENSE.md file in the root directory. *)(* *)(* *)(**************************************************************************)moduleT=OpamParserTypesmoduleF=OpamParserTypes.FullPosmoduleOpamParserTypes=struct(** Defines the types for the opam format lexer and parser *)(** Type definitions used by the legacy and the new full position modules *)(** Relational operators *)typerelop=[`Eq(** [=] *)|`Neq(** [!=] *)|`Geq(** [>=] *)|`Gt(** [>] *)|`Leq(** [<=] *)|`Lt(** [<] *)](** Logical operators *)typelogop=[`And(** [&] *)|`Or(** [|] *)](** Prefix operators *)typepfxop=[`Not(** [!] *)|`Defined(** [?] *)]typefile_name=string(** Source file positions: [(filename, line, column)] *)typepos=file_name*int*int(** Environment variable update operators *)typeenv_update_op=T.env_update_op=Eq(** [=] *)|PlusEq(** [+=] *)|EqPlus(** [=+] *)|ColonEq(** [:=] *)|EqColon(** [=:] *)|EqPlusEq(** [=+=] *)(** [OpamParserTypes] transitional module with full position types *)moduleFullPos=struct(** Source file positions *)typefile_name=string(** Full position *)typepos=F.pos={filename:file_name;start:int*int;(* line, column *)stop:int*int;(* line, column *)}(** [with_pos] type, used for all units, embedding the element [pelem] ans
its position [pos] *)type'awith_pos='aF.with_pos={pelem:'a;pos:pos}typerelop_kind=reloptyperelop=relop_kindwith_postypelogop_kind=logoptypelogop=logop_kindwith_postypepfxop_kind=pfxoptypepfxop=pfxop_kindwith_postypeenv_update_op_kind=env_update_optypeenv_update_op=env_update_op_kindwith_pos(** Base values *)typevalue_kind=F.value_kind=|Boolofbool(** [bool] atoms *)|Intofint(** [int] atoms *)|Stringofstring(** [string] atoms *)|Relopofrelop*value*value(** Relational operators with two values (e.g. [os != "win32"]) *)|Prefix_relopofrelop*value(** Relational operators in prefix position (e.g. [< "4.07.0"]) *)|Logopoflogop*value*value(** Logical operators *)|Pfxopofpfxop*value(** Prefix operators *)|Identofstring(** Identifiers *)|Listofvaluelistwith_pos(** Lists of values ([[x1 x2 ... x3]]) *)|Groupofvaluelistwith_pos(** Groups of values ([(x1 x2 ... x3)]) *)|Optionofvalue*valuelistwith_pos(** Value with optional list ([x1 {x2 x3 x4}]) *)|Env_bindingofvalue*env_update_op*value(** Environment variable binding ([FOO += "bar"]) *)andvalue=value_kindwith_pos(** An opamfile section *)typeopamfile_section=F.opamfile_section={section_kind:stringwith_pos;(** Section kind
(e.g. [extra-source]) *)section_name:stringwith_posoption;(** Section name
(e.g. ["myfork.patch"]) *)section_items:opamfile_itemlistwith_pos;(** Content of the section *)}(** An opamfile is composed of sections and variable definitions *)andopamfile_item_kind=F.opamfile_item_kind=|Sectionofopamfile_section(** e.g. [kind ["name"] { ... }] *)|Variableofstringwith_pos*value(** e.g. [opam-version: "2.0"] *)andopamfile_item=opamfile_item_kindwith_pos(** A file is a list of items and the filename *)typeopamfile=F.opamfile={file_contents:opamfile_itemlist;(** Content of the file *)file_name:file_name;(** Name of the disk file this record was
loaded from *)}endendmoduleOpamParser=OpamParsermoduleOpamPrinter=OpamPrinter