package opam-file-format

  1. Overview
  2. Docs

opam format parser

Raw OpamBaseParser entry points

Providing a custom lexbuf argument allows you, for example, to set the initial lexing position. For the first argument, you may use the OpamLexer.token lexing function:

let lexbuf = Lexing.from_string input in
lexbuf.Lexing.lex_curr_p <- current_position;
OpamParser.value OpamLexer.token lexbuf

Principal parser: given a lexbuf and the filename it was read from, returns an OpamParserTypes.opamfile record parsed from it.

Lower-level function just returning a single OpamParserTypes.value from a given lexer.

File parsers

Parse the content of a file already read to a string. Note that for CRLF-detection to work on Windows, it is necessary to read the original file using binary mode on Windows!

Parse the content of a file from an already-opened channel. Note that for CRLF-detection to work on Windows, it is necessary for the channel to be in binary mode!

Parse the content of a file. The file is opened in binary mode, so CRLF-detection works on all platforms.

value parsers

val value_from_string : string -> OpamParserTypes.file_name -> OpamParserTypes.value

Parse the first value in the given string. file_name is used for lexer positions.

Parse the first value from the given channel. file_name is used for lexer positions.

Parse the first value from the given file.

OCaml

Innovation. Community. Security.