Current section

Files

Jump to
caffeine_lang src caffeine_lang@parser@linker.erl
Raw

src/caffeine_lang@parser@linker.erl

-module(caffeine_lang@parser@linker).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/caffeine_lang/parser/linker.gleam").
-export([link/2]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-file("src/caffeine_lang/parser/linker.gleam", 47).
-spec parse_expectation_files(
list(binary()),
list(caffeine_lang@parser@blueprints:blueprint())
) -> {ok,
list({list({caffeine_lang@parser@expectations:expectation(),
caffeine_lang@parser@blueprints:blueprint()}),
binary()})} |
{error, caffeine_lang@common@errors:compilation_error()}.
parse_expectation_files(Files, Blueprints) ->
_pipe = Files,
_pipe@2 = gleam@list:map(
_pipe,
fun(File_path) ->
_pipe@1 = caffeine_lang@parser@expectations:parse_from_json_file(
File_path,
Blueprints
),
gleam@result:map(_pipe@1, fun(Exps) -> {Exps, File_path} end)
end
),
gleam@result:all(_pipe@2).
-file("src/caffeine_lang/parser/linker.gleam", 26).
?DOC(false).
-spec link(binary(), binary()) -> {ok,
list(caffeine_lang@middle_end@semantic_analyzer:intermediate_representation())} |
{error, caffeine_lang@common@errors:compilation_error()}.
link(Blueprint_file_path, Expectations_directory) ->
gleam@result:'try'(
caffeine_lang@parser@file_discovery:get_json_files(
Expectations_directory
),
fun(Expectation_files) ->
gleam@result:'try'(
caffeine_lang@parser@artifacts:parse_standard_library(),
fun(Artifacts) ->
gleam@result:'try'(
caffeine_lang@parser@blueprints:parse_from_json_file(
Blueprint_file_path,
Artifacts
),
fun(Blueprints) ->
gleam@result:'try'(
parse_expectation_files(
Expectation_files,
Blueprints
),
fun(Expectations_with_paths) ->
{ok,
caffeine_lang@parser@ir_builder:build_all(
Expectations_with_paths
)}
end
)
end
)
end
)
end
).