Orocos Real-Time Toolkit
2.9.0
|
This class is the public interface to the Orocos Program Parser Framework. More...
#include <rtt/scripting/Parser.hpp>
Public Types | |
typedef std::vector< ProgramInterfacePtr > | ParsedFunctions |
List of parsed functions. More... | |
typedef std::vector< ProgramInterfacePtr > | ParsedPrograms |
List of parsed programs. More... | |
typedef std::vector< ParsedStateMachinePtr > | ParsedStateMachines |
List of parsed State Machines. More... | |
Public Member Functions | |
Parser (ExecutionEngine *caller=0) | |
Create a parser and allow to explicitly specify which TaskContext's ExecutionEngine is calling it. More... | |
void | runScript (std::string const &code, TaskContext *mowner, ScriptingService *service, std::string const &filename) |
Runs all statements in code. More... | |
ParsedFunctions | parseFunction (const std::string &s, TaskContext *, const std::string &filename="stream") |
Reads out the string, parses it, and returns a new FunctionGraph. More... | |
ParsedPrograms | parseProgram (const std::string &s, TaskContext *, const std::string &filename="stream") |
Reads out the string, parses it, and returns a new ProgramGraph. More... | |
ParsedStateMachines | parseStateMachine (const std::string &s, TaskContext *, const std::string &filename="stream") |
Reads out the string, parses it, and returns a new ParsedStateMachine. More... | |
ConditionInterface * | parseCondition (const std::string &s, TaskContext *) |
Parses the string as a condition, and returns a new ConditionInterface. More... | |
base::DataSourceBase::shared_ptr | parseExpression (const std::string &s, TaskContext *) |
Parses the expression in s. More... | |
base::DataSourceBase::shared_ptr | parseValueChange (const std::string &s, TaskContext *) |
Parses a change of a value in s. More... | |
base::DataSourceBase::shared_ptr | parseValueStatement (const std::string &s, TaskContext *) |
Parses a whole value manipulation/creation statement. More... | |
This class is the public interface to the Orocos Program Parser Framework.
It parsers Orocos program scripts, Orocos State Contexts and allows to parse a text Command, Condition or Expression to the respective objects.
Definition at line 65 of file Parser.hpp.
typedef std::vector< ProgramInterfacePtr > RTT::scripting::Parser::ParsedFunctions |
List of parsed functions.
Definition at line 89 of file Parser.hpp.
typedef std::vector< ProgramInterfacePtr > RTT::scripting::Parser::ParsedPrograms |
List of parsed programs.
Definition at line 101 of file Parser.hpp.
typedef std::vector< ParsedStateMachinePtr > RTT::scripting::Parser::ParsedStateMachines |
List of parsed State Machines.
Definition at line 113 of file Parser.hpp.
RTT::Parser::Parser | ( | ExecutionEngine * | caller = 0 | ) |
Create a parser and allow to explicitly specify which TaskContext's ExecutionEngine is calling it.
This allows to generate the correct asynchonous method invocation code in case caller and parser are not identical.
Definition at line 54 of file Parser.cpp.
References RTT::Debug, and RTT::internal::GlobalEngine::Instance().
ConditionInterface * RTT::Parser::parseCondition | ( | const std::string & | s, |
TaskContext * | tc | ||
) |
Parses the string as a condition, and returns a new ConditionInterface.
Will throw parse_exception on failure. Use ext to get the data from the components.
parse_exception |
Definition at line 131 of file Parser.cpp.
References RTT::base::TaskCore::engine(), RTT::scripting::ConditionInterface::reset(), and SKIP_PARSER.
DataSourceBase::shared_ptr RTT::Parser::parseExpression | ( | const std::string & | s, |
TaskContext * | tc | ||
) |
Parses the expression in s.
parse_exception | Throws exceptions of type parse_exception. |
Definition at line 160 of file Parser.cpp.
References RTT::scripting::ExpressionParser::dropResult(), RTT::scripting::ExpressionParser::getResult(), RTT::scripting::ExpressionParser::hasResult(), RTT::scripting::ExpressionParser::parser(), and SKIP_PARSER.
Referenced by RTT::StatementProcessor::D::doPrint(), and parseValueChange().
Parser::ParsedFunctions RTT::Parser::parseFunction | ( | const std::string & | s, |
TaskContext * | c, | ||
const std::string & | filename = "stream" |
||
) |
Reads out the string, parses it, and returns a new FunctionGraph.
parse_exception | Throws exceptions of type parse_exception. |
Definition at line 81 of file Parser.cpp.
References RTT::base::TaskCore::engine(), and RTT::scripting::ProgramGraphParser::parseFunction().
Parser::ParsedPrograms RTT::Parser::parseProgram | ( | const std::string & | s, |
TaskContext * | c, | ||
const std::string & | filename = "stream" |
||
) |
Reads out the string, parses it, and returns a new ProgramGraph.
parse_exception | Throws exceptions of type parse_exception. |
Definition at line 93 of file Parser.cpp.
References RTT::base::TaskCore::engine(), and RTT::scripting::ProgramGraphParser::parse().
Parser::ParsedStateMachines RTT::Parser::parseStateMachine | ( | const std::string & | s, |
TaskContext * | c, | ||
const std::string & | filename = "stream" |
||
) |
Reads out the string, parses it, and returns a new ParsedStateMachine.
file_parse_exception | Throws exceptions of type file_parse_exception. |
Definition at line 107 of file Parser.cpp.
References RTT::parse_exception::copy(), RTT::base::TaskCore::engine(), and RTT::scripting::StateGraphParser::parse().
DataSourceBase::shared_ptr RTT::Parser::parseValueChange | ( | const std::string & | s, |
TaskContext * | tc | ||
) |
Parses a change of a value in s.
parse_exception | Throws exceptions of type parse_exception. |
Definition at line 191 of file Parser.cpp.
References parseExpression().
Referenced by RTT::StatementProcessor::D::doPrint().
DataSourceBase::shared_ptr RTT::Parser::parseValueStatement | ( | const std::string & | s, |
TaskContext * | tc | ||
) |
Parses a whole value manipulation/creation statement.
Requires the set/var/const etc prefixes.
parse_exception | Throws exceptions of type parse_exception. |
Definition at line 197 of file Parser.cpp.
References RTT::base::TaskCore::engine(), RTT::base::ActionInterface::execute(), RTT::TaskContext::provides(), RTT::base::ActionInterface::readArguments(), and SKIP_PARSER.
void RTT::Parser::runScript | ( | std::string const & | code, |
TaskContext * | mowner, | ||
ScriptingService * | service, | ||
std::string const & | filename | ||
) |
Runs all statements in code.
code | A list of scripting statements and definitions |
mowner | The task in which the code must be interpreted |
filename | An informational description of the source of code. |
parse_exception | and its derivatives. |
Definition at line 62 of file Parser.cpp.
References RTT::parse_exception::copy().
Referenced by RTT::scripting::ScriptingService::evalInternal().