49 #include "../internal/DataSourceCommand.hpp" 52 #include "../internal/GlobalEngine.hpp" 58 using namespace boost;
62 using namespace detail;
67 log(
Debug) <<
"WARNING: Parser does not know which TaskContext is executing (calling) the parsed code. Using Global Engine. Please specify the caller explicitly in order to avoid any asynchronous operation problems." <<
endlog();
74 our_pos_iter_t parsebegin( script.begin(), script.end(), filename );
81 gram.parse( parsebegin, parseend );
86 exc.
copy(), parsebegin.get_position().file,
87 parsebegin.get_position().line, parsebegin.get_position().column );
94 our_pos_iter_t parsebegin(
function.begin(),
function.end(), filename );
95 our_pos_iter_t parseend(
function.end(),
function.end(), filename );
106 our_pos_iter_t parsebegin( program.begin(), program.end(), filename );
122 our_pos_iter_t parsebegin( program.begin(), program.end(), filename );
130 ret = gram.
parse( parsebegin, parseend );
135 exc.
copy(), parsebegin.get_position().file,
136 parsebegin.get_position().line, parsebegin.get_position().column );
145 our_pos_iter_t parsebegin( scopy.begin(), scopy.end(),
"teststring" );
146 our_pos_iter_t parseend( scopy.end(), scopy.end(),
"teststring" );
153 parse( parsebegin, parseend, parser.parser(),
SKIP_PARSER );
159 catch(
const parser_error<std::string, iter_t>& e )
189 catch(
const parser_error<std::string, iter_t>& e )
220 parse( parsebegin, parseend, parser.parser(),
SKIP_PARSER );
226 catch(
const parser_error<std::string, iter_t>& e )
233 std::vector<ActionInterface*> acv = parser.assignCommands();
235 if ( acv.empty() && parser.lastDefinedValue() ) {
236 return parser.lastDefinedValue()->getDataSource();
238 if ( acv.size() == 1 ) {
245 return parser.lastDefinedValue()->getDataSource();
247 else if (acv.size() > 1) {
ParsedFunctions parseFunction(const std::string &s, TaskContext *, const std::string &filename="stream")
Reads out the string, parses it, and returns a new FunctionGraph.
Service::shared_ptr provides()
This interface represents the concept of a condition which can be evaluated and return true or false...
virtual void readArguments()=0
base::DataSourceBase::shared_ptr parseValueStatement(const std::string &s, TaskContext *)
Parses a whole value manipulation/creation statement. Requires the set/var/const etc prefixes...
ExecutionEngine * mcaller
A Parser for Orocos Program Scripts.
virtual parse_exception * copy() const =0
void runScript(std::string const &code, TaskContext *mowner, ScriptingService *service, std::string const &filename)
This class contains some very common parser definitions.
ConditionInterface * parseCondition(const std::string &s, TaskContext *)
Parses the string as a condition, and returns a new ConditionInterface. Will throw parse_exception on...
position_iterator< our_iterator_t > our_pos_iter_t
ParsedStateMachines parseStateMachine(const std::string &s, TaskContext *, const std::string &filename="stream")
Reads out the string, parses it, and returns a new ParsedStateMachine.
static RTT_API ExecutionEngine * Instance()
std::vector< ProgramInterfacePtr > ParsedPrograms
Based on the software pattern 'command', this interface allows execution of action objects...
base::DataSourceBase::shared_ptr getResult()
std::vector< ProgramInterfacePtr > ParsedFunctions
base::DataSourceBase::shared_ptr parseExpression(const std::string &s, TaskContext *)
Parses the expression in s.
std::vector< ProgramInterfacePtr > parse(iter_t &begin, iter_t end)
Tries to parse programs, returns the generated programs on success.
std::vector< ProgramInterfacePtr > parseFunction(iter_t &begin, iter_t end)
ParsedPrograms parseProgram(const std::string &s, TaskContext *, const std::string &filename="stream")
Reads out the string, parses it, and returns a new ProgramGraph.
std::vector< ParsedStateMachinePtr > ParsedStateMachines
boost::intrusive_ptr< DataSourceBase > shared_ptr
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Based on the software pattern 'composite', this class RTT_SCRIPTING_API allows composing command obje...
const ExecutionEngine * engine() const
static Logger::LogFunction endlog()
std::vector< ParsedStateMachinePtr > parse(iter_t &begin, iter_t end)
base::DataSourceBase::shared_ptr parseValueChange(const std::string &s, TaskContext *)
Parses a change of a value in s.