Current section
Files
Jump to
Current section
Files
src/bt_engine/yaml_parser/yaml_parse_root.erl
-module(yaml_parse_root).
-export([
parse/3
]).
%% yaml dictionary is a map of subtree name => unparsed subtree yaml. this
%% can be extended by reading more files.
%% args is a proplist of {param, value}
-spec parse(FilePath :: string(), TreeName :: string(), Args :: list({string(), term()}) ) -> {ParsedTree :: term(), Blackboard :: term()}.
parse(RootFilePath, TreeName, Args) ->
%% read yaml file
YAMLDictionary = yaml_parser_utils:read_file(RootFilePath),
bt_yaml_parser:parse(
{TreeName, [{"args", Args}, {"ref", RootFilePath}]},
bt_parser_utils:get_namespace(), #{},
bt_blackboard:get_empty(), YAMLDictionary,
filename:dirname(RootFilePath)
).