src/yum@yaml@parser@single_quoted.erl
-module(yum@yaml@parser@single_quoted).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/yum/yaml/parser/single_quoted.gleam").
-export([parser/0]).
-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(false).
-file("src/yum/yaml/parser/single_quoted.gleam", 10).
?DOC(false).
-spec parser() -> nibble:parser(yum@yaml@node:node_(), yum@yaml@token:token(), yum@yaml@lexer@context:context()).
parser() ->
nibble:do(
nibble:token(single_quote),
fun(_) ->
nibble:do(
nibble:span(),
fun(Start) ->
nibble:do(
nibble:many(
begin
nibble:take_map(
<<"Expected a single quoted value"/utf8>>,
fun(Tok) -> case Tok of
{single_quoted_scalar, Value} ->
{some, Value};
hyphen ->
none;
question_mark ->
none;
colon ->
none;
comma ->
none;
open_sequence ->
none;
close_sequence ->
none;
open_mapping ->
none;
close_mapping ->
none;
hash ->
none;
document_start ->
none;
document_end ->
none;
ampersand ->
none;
asterisk ->
none;
exclamation ->
none;
vertical_bar ->
none;
greater_than ->
none;
single_quote ->
none;
double_quote ->
none;
percent ->
none;
at ->
none;
grave_accent ->
none;
line_break ->
none;
{indentation, _} ->
none;
{double_quoted_scalar, _} ->
none;
{mapping_key, _} ->
none;
{plain_scalar, _} ->
none;
{anchor, _} ->
none;
{alias, _} ->
none;
{tag, _} ->
none;
{block_scalar_header, _, _, _} ->
none;
{block_scalar_line, _, _} ->
none;
{directive, _, _} ->
none;
{escape, _} ->
none;
invalid_escape ->
none
end end
)
end
),
fun(Parts) ->
nibble:do(nibble:span(), fun(End) -> _pipe = Parts,
_pipe@1 = erlang:list_to_binary(_pipe),
_pipe@2 = yum@yaml@parser@double_quoted:fold_scalar(
_pipe@1,
false
),
_pipe@3 = {string, _pipe@2},
_pipe@4 = yum@yaml@node:new(
_pipe@3,
yum@yaml@parser@span:between(Start, End),
single_quoted_scalar
),
nibble:return(_pipe@4) end)
end
)
end
)
end
).