Orocos Real-Time Toolkit
2.9.0
|
A Parser for Orocos Program Scripts. More...
#include <rtt/scripting/ProgramGraphParser.hpp>
Public Member Functions | |
ProgramGraphParser (iter_t &positer, TaskContext *context, ExecutionEngine *caller, CommonParser &cp) | |
~ProgramGraphParser () | |
std::vector< ProgramInterfacePtr > | parse (iter_t &begin, iter_t end) |
Tries to parse programs, returns the generated programs on success. More... | |
std::vector< ProgramInterfacePtr > | parseFunction (iter_t &begin, iter_t end) |
void | initBodyParser (const std::string &name, Service::shared_ptr stck, int offset) |
Initialize the bodyParser to parse and store each statement it sees. More... | |
rule_t & | bodyParser () |
Parses a multi-line program, which you can retrieve with bodyParserResult(). More... | |
rule_t & | statementParser () |
Parses a single-line statement. More... | |
rule_t & | programParser () |
Returns a program foo {} parser. More... | |
ProgramInterfacePtr | programParserResult () |
Returns the last program parsed by programParser() More... | |
rule_t & | functionParser () |
Parses a function foo {} definition. More... | |
ProgramInterfacePtr | bodyParserResult () |
bool | parserUsed () const |
Returns true if the parser was already used (even partially). More... | |
A Parser for Orocos Program Scripts.
This class does the actual work. It generates a Program, by constructing the ProgramNode's. We just go over the code one single time, and construct the Program as we go. For every statement, we construct a new ProgramNode, and fill it up as we get the information we need.
Definition at line 72 of file ProgramGraphParser.hpp.
RTT::ProgramGraphParser::ProgramGraphParser | ( | iter_t & | positer, |
TaskContext * | context, | ||
ExecutionEngine * | caller, | ||
CommonParser & | cp | ||
) |
Definition at line 85 of file ProgramGraphParser.cpp.
RTT::ProgramGraphParser::~ProgramGraphParser | ( | ) |
Definition at line 105 of file ProgramGraphParser.cpp.
References RTT::scripting::ValueChangeParser::bareDefinitionParser(), RTT::scripting::CommonParser::eos, RTT::scripting::CommonParser::identifier, keyword_p, RTT::scripting::CommonParser::notassertingidentifier, RTT::scripting::ConditionParser::parser(), RTT::scripting::ValueChangeParser::parser(), and RTT::scripting::ExpressionParser::parser().
rule_t & RTT::ProgramGraphParser::bodyParser | ( | ) |
Parses a multi-line program, which you can retrieve with bodyParserResult().
You need to initialize it with initBodyParser
Definition at line 233 of file ProgramGraphParser.cpp.
Referenced by RTT::scripting::StateGraphParser::getParserResult().
ProgramInterfacePtr RTT::ProgramGraphParser::bodyParserResult | ( | ) |
Definition at line 256 of file ProgramGraphParser.cpp.
References RTT::scripting::ValueChangeParser::reset(), and RTT::scripting::ValueChangeParser::store().
Referenced by RTT::scripting::StateGraphParser::getParserResult(), and RTT::scripting::ScriptParser::ScriptParser().
rule_t & RTT::ProgramGraphParser::functionParser | ( | ) |
Parses a function foo {} definition.
Definition at line 229 of file ProgramGraphParser.cpp.
Referenced by RTT::scripting::ScriptParser::ScriptParser().
void RTT::ProgramGraphParser::initBodyParser | ( | const std::string & | name, |
Service::shared_ptr | stck, | ||
int | offset | ||
) |
Initialize the bodyParser to parse and store each statement it sees.
The result is retrieved with bodyParserResult().
Definition at line 217 of file ProgramGraphParser.cpp.
Referenced by RTT::scripting::StateGraphParser::getParserResult(), and RTT::scripting::ScriptParser::ScriptParser().
std::vector< ProgramInterfacePtr > RTT::ProgramGraphParser::parse | ( | iter_t & | begin, |
iter_t | end | ||
) |
Tries to parse programs, returns the generated programs on success.
file_parse_exception | The parser found an error. |
Definition at line 680 of file ProgramGraphParser.cpp.
References RTT::parse_exception::copy(), and RTT::scripting::CommonParser::skipper.
Referenced by RTT::scripting::Parser::parseProgram().
std::vector< ProgramInterfacePtr > RTT::ProgramGraphParser::parseFunction | ( | iter_t & | begin, |
iter_t | end | ||
) |
Definition at line 734 of file ProgramGraphParser.cpp.
References RTT::scripting::ValueChangeParser::assignCommands(), RTT::scripting::ValueChangeParser::assignConditions(), RTT::scripting::ValueChangeParser::clear(), RTT::parse_exception::copy(), RTT::scripting::ExpressionParser::dropResult(), RTT::scripting::ExpressionParser::getCmdResult(), RTT::scripting::ExpressionParser::getResult(), RTT::TaskContext::provides(), RTT::scripting::ConditionParser::reset(), RTT::scripting::PeerParser::reset(), RTT::scripting::ValueChangeParser::reset(), RTT::scripting::TryCommand::result(), and RTT::scripting::CommonParser::skipper.
Referenced by RTT::scripting::Parser::parseFunction().
bool RTT::ProgramGraphParser::parserUsed | ( | ) | const |
Returns true if the parser was already used (even partially).
an initBodyParser will reset this to false.
Definition at line 276 of file ProgramGraphParser.cpp.
References RTT::scripting::ValueChangeParser::assignCommands(), RTT::types::TypeInfo::buildAttribute(), RTT::scripting::ValueChangeParser::clear(), RTT::base::AttributeBase::clone(), RTT::Logger::Debug, RTT::scripting::ExpressionParser::dropResult(), RTT::Logger::endl(), RTT::base::TaskCore::engine(), RTT::wrong_types_of_args_exception::expected_, RTT::base::AttributeBase::getDataSource(), RTT::TaskContext::getName(), RTT::scripting::ConditionParser::getParseResult(), RTT::scripting::ConditionParser::getParseResultAsCommand(), RTT::scripting::ExpressionParser::getResult(), RTT::Logger::Info, RTT::internal::GlobalService::Instance(), RTT::types::TypeInfoRepository::Instance(), RTT::scripting::ValueChangeParser::lastDefinedValue(), RTT::scripting::ValueChangeParser::load(), RTT::Logger::log(), RTT::scripting::ArgumentsParser::parser(), RTT::TaskContext::provides(), RTT::wrong_number_of_args_exception::received, RTT::wrong_types_of_args_exception::received_, RTT::scripting::ValueChangeParser::reset(), RTT::scripting::ArgumentsParser::result(), RTT::scripting::CommonParser::skipeol, RTT::scripting::ValueChangeParser::store(), RTT::wrong_number_of_args_exception::wanted, RTT::Warning, and RTT::wrong_types_of_args_exception::whicharg.
rule_t & RTT::ProgramGraphParser::programParser | ( | ) |
Returns a program foo {} parser.
Definition at line 225 of file ProgramGraphParser.cpp.
Referenced by RTT::scripting::ScriptParser::ScriptParser().
ProgramInterfacePtr RTT::ProgramGraphParser::programParserResult | ( | ) |
Returns the last program parsed by programParser()
Definition at line 243 of file ProgramGraphParser.cpp.
Referenced by RTT::scripting::ScriptParser::ScriptParser().
rule_t & RTT::ProgramGraphParser::statementParser | ( | ) |
Parses a single-line statement.
Definition at line 238 of file ProgramGraphParser.cpp.
Referenced by RTT::scripting::ScriptParser::ScriptParser().