script_parser.hpp
Go to the documentation of this file.
1 /* Copyright (C) 2022 Davide Faconti - All Rights Reserved
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
4 * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
5 * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
10 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 */
12 
13 #pragma once
14 
16 
17 namespace BT
18 {
19 
22 using EnumsTable = std::unordered_map<std::string, int>;
23 using EnumsTablePtr = std::shared_ptr<EnumsTable>;
24 
25 namespace Ast
26 {
32 {
35 };
36 } // namespace Ast
37 
41 Result ValidateScript(const std::string& script);
42 
43 using ScriptFunction = std::function<Any(Ast::Environment& env)>;
44 
45 Expected<ScriptFunction> ParseScript(const std::string& script);
46 
47 Expected<Any> ParseScriptAndExecute(Ast::Environment& env, const std::string& script);
48 
49 } // namespace BT
BT
Definition: ex01_wrap_legacy.cpp:29
BT::ParseScript
Expected< ScriptFunction > ParseScript(const std::string &script)
Definition: script_parser.cpp:14
BT::Any
Definition: safe_any.hpp:36
BT::Ast::Environment::enums
EnumsTablePtr enums
Definition: script_parser.hpp:34
BT::Expected
nonstd::expected< T, std::string > Expected
Definition: basic_types.h:85
BT::ScriptFunction
std::function< Any(Ast::Environment &env)> ScriptFunction
Definition: script_parser.hpp:43
BT::Ast::Environment::vars
BT::Blackboard::Ptr vars
Definition: script_parser.hpp:33
BT::EnumsTablePtr
std::shared_ptr< EnumsTable > EnumsTablePtr
Definition: script_parser.hpp:23
BT::EnumsTable
std::unordered_map< std::string, int > EnumsTable
Definition: script_parser.hpp:22
BT::Blackboard::Ptr
std::shared_ptr< Blackboard > Ptr
Definition: blackboard.h:35
BT::ParseScriptAndExecute
Expected< Any > ParseScriptAndExecute(Ast::Environment &env, const std::string &script)
Definition: script_parser.cpp:57
BT::ValidateScript
Result ValidateScript(const std::string &script)
ValidateScript will check if a certain string is valid.
Definition: script_parser.cpp:70
BT::Result
Expected< std::monostate > Result
Definition: basic_types.h:333
blackboard.h
BT::Ast::Environment
The Environment class is used to encapsulate the information and states needed by the scripting langu...
Definition: script_parser.hpp:31


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Jun 28 2024 02:20:08