45 #include "../TaskContext.hpp" 46 #include "../internal/Exceptions.hpp" 52 #include <boost/bind.hpp> 53 #include <boost/lambda/lambda.hpp> 54 #include <boost/call_traits.hpp> 57 #include "../internal/mystd.hpp" 58 #include "../internal/GlobalEngine.hpp" 63 using namespace boost;
64 using namespace detail;
70 boost::spirit::classic::assertion<std::string> expect_eof(
"Invalid input in file.");
71 guard<std::string> no_function_guard;
78 if ( programparser->parserUsed() == false )
79 return error_status<>( error_status<>::fail );
81 return error_status<>( error_status<>::rethrow );
86 context(tc), caller(tcaller), storage(
Service::Create(
"stack") ),
87 mpositer(positer), ln_offset(0),
90 stateparser(new
StateGraphParser(mpositer, context, context->engine(), commonparser)),
91 programparser(new
ProgramGraphParser(mpositer, context, context->engine(), *commonparser)),
97 BOOST_SPIRIT_DEBUG_RULE(
program );
98 BOOST_SPIRIT_DEBUG_RULE(
function );
109 >> expect_eof(end_p);
130 while (ret->execute() && ret->isRunning())
135 <<
"Script encountered an error during execution of line " 136 << ret->getLineNumber() <<
endlog();
142 <<
"Parser refuses to execute more than 10000 yield statements. Fix your program." 164 log(
Info) <<
"Loading Program '"<< ret->getName() <<
"'" <<
endlog();
165 if ( ss->loadProgram( ret ) ==
false)
166 throw program_load_exception(
"Could not load Program '"+ ret->getName() +
"' :\n failed to load in ScriptingService.\n");
168 log(
Error) <<
"Could not load Program '"<< ret->getName() <<
"' :" <<
endlog();
193 log(
Info) <<
"Loading StateMachine '"<< ret->getName() <<
"'" <<
endlog();
194 ss->loadStateMachine( ret );
196 log(
Error) <<
"Could not load StateMachine'"<< ret->getName() <<
"' :" <<
endlog();
212 | comment_p(
"/*",
"*/")
232 "Syntax error"),
mpositer.get_position().file,
237 }
catch (
const parser_error<std::string, iter_t>& e)
243 e.descriptor),
mpositer.get_position().file,
boost::shared_ptr< ScriptingService > shared_ptr
boost::shared_ptr< ParsedStateMachine > ParsedStateMachinePtr
const char * what() const
boost::shared_ptr< FunctionGraph > FunctionGraphPtr
Service::shared_ptr provides()
ProgramInterfacePtr bodyParserResult()
void parse(iter_t &begin, iter_t end)
Service::shared_ptr storage
our_pos_iter_t & mpositer
A Parser for Orocos Program Scripts.
boost::shared_ptr< ProgramInterface > ProgramInterfacePtr
virtual parse_exception * copy() const =0
void initBodyParser(const std::string &name, Service::shared_ptr stck, int offset)
This class contains some very common parser definitions.
CommonParser * commonparser
ProgramInterfacePtr programParserResult()
ScriptParser(iter_t &positer, TaskContext *tc, ExecutionEngine *caller)
scanner< iter_t, scanner_pol_t > scanner_t
StateGraphParser * stateparser
rule_t & functionParser()
ParsedStateMachinePtr getParserResult()
skip_parser_iteration_policy< skip_parser_t > iter_pol_t
static RTT_API ExecutionEngine * Instance()
functor_parser< eol_skip_functor > skipper
rule_t & statementParser()
ProgramGraphParser * programparser
boost_spirit::alternative< boost_spirit::alternative< boost_spirit::alternative< boost_spirit::alternative< boost_spirit::confix_parser< boost_spirit::impl::string_as_parser::type, boost_spirit::kleene_star< boost_spirit::anychar_parser >, boost_spirit::alternative< boost_spirit::eol_parser, boost_spirit::end_parser >, boost_spirit::unary_parser_category, boost_spirit::non_nested, boost_spirit::is_lexeme >, boost_spirit::confix_parser< boost_spirit::impl::string_as_parser::type, boost_spirit::kleene_star< boost_spirit::anychar_parser >, boost_spirit::alternative< boost_spirit::eol_parser, boost_spirit::end_parser >, boost_spirit::unary_parser_category, boost_spirit::non_nested, boost_spirit::is_lexeme > >, boost_spirit::confix_parser< boost_spirit::impl::string_as_parser::type, boost_spirit::kleene_star< boost_spirit::anychar_parser >, boost_spirit::impl::string_as_parser::type, boost_spirit::unary_parser_category, boost_spirit::non_nested, boost_spirit::is_lexeme > >, boost_spirit::difference< boost_spirit::space_parser, boost_spirit::eol_parser > >, boost_spirit::functor_parser< eol_skip_functor > > skip_parser_t
error_status handle_no_function(scanner_t const &scan, parser_error< std::string, iter_t > &e)
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
ProgramGraphParser * statementparser
scanner_policies< iter_pol_t > scanner_pol_t
static Logger::LogFunction endlog()
void setText(const std::string &t)