Skip to main content

src/yum.erl

-module(yum).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/yum.gleam").
-export([parse/1, parse_stream/1]).

-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.

?MODULEDOC(
    " Compatibility entry point for parsing YAML.\n"
    "\n"
    " Prefer importing [`yum/yaml`](./yum/yaml.html) in new code. This module keeps [`yum.parse`](./yum/yaml.html#parse)\n"
    " available as a small forwarding wrapper.\n"
    "\n"
).

-file("src/yum.gleam", 14).
?DOC(
    " Parses a YAML file into a YAML document.\n"
    "\n"
    " Follows the [YAML 1.2 specification](https://yaml.org/spec/1.2.2/)\n"
).
-spec parse(binary()) -> {ok, yum@yaml:yaml()} |
    {error, yum@yaml@error:yaml_error()}.
parse(Input) ->
    yum@yaml:parse(Input).

-file("src/yum.gleam", 20).
?DOC(" Parses a YAML stream into a list of YAML documents.\n").
-spec parse_stream(binary()) -> {ok, list(yum@yaml:yaml())} |
    {error, yum@yaml@error:yaml_error()}.
parse_stream(Input) ->
    yum@yaml:parse_stream(Input).