Library
Module
Module type
Parameter
Class
Class type
opam format parser
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
val main :
(Lexing.lexbuf -> OpamBaseParser.token) ->
Lexing.lexbuf ->
OpamParserTypes.file_name ->
OpamParserTypes.opamfile
Principal parser: given a lexbuf and the filename it was read from, returns an OpamParserTypes.opamfile
record parsed from it.
val value :
(Lexing.lexbuf -> OpamBaseParser.token) ->
Lexing.lexbuf ->
OpamParserTypes.value
Lower-level function just returning a single OpamParserTypes.value
from a given lexer.
val string : string -> OpamParserTypes.file_name -> OpamParserTypes.opamfile
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!
val channel :
in_channel ->
OpamParserTypes.file_name ->
OpamParserTypes.opamfile
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!
val file : OpamParserTypes.file_name -> OpamParserTypes.opamfile
Parse the content of a file. The file is opened in binary mode, so CRLF-detection works on all platforms.
value
parsersval value_from_string :
string ->
OpamParserTypes.file_name ->
OpamParserTypes.value
Parse the first value in the given string. file_name
is used for lexer positions.
val value_from_channel :
in_channel ->
OpamParserTypes.file_name ->
OpamParserTypes.value
Parse the first value from the given channel. file_name
is used for lexer positions.
val value_from_file : OpamParserTypes.file_name -> OpamParserTypes.value
Parse the first value from the given file.