38 #ifndef EXECUTION_PROGRAM_PARSER_HPP 39 #define EXECUTION_PROGRAM_PARSER_HPP 47 #include "../TaskContext.hpp" 61 namespace RTT {
namespace scripting
108 typedef std::map<std::string, FunctionGraphPtr> funcmap;
117 std::vector<ConditionInterface*> implcond_v;
118 std::vector<base::DataSourceBase::shared_ptr> callfnargs;
125 void seencondition();
129 void seencontinue( );
134 void seenstatement();
135 void seentrystatement();
136 void startcatchpart();
137 void seencatchpart();
139 void seenvaluechange();
144 void seenfunctionarg();
145 void seenfunctionend();
146 void seenvalidinput();
149 void seencallfuncstatement();
150 void seencallfuncargs();
152 void seenreturnstatement();
153 void seenreturnlabel();
154 void seenreturnvalue();
157 void seenifstatement();
159 void endifstatement();
161 void seenwhilestatement();
162 void endwhilestatement();
164 void seenbreakstatement();
166 void seenforstatement();
168 void seenforinit_expr();
170 void seenemptyforincr();
171 void endforstatement();
173 void startofprogram();
175 void seenprogramend();
180 void clearParseState();
183 void cleanup(
bool remove_service);
185 rule_t newline, terminationclause, jumpdestination, terminationpart, andpart,
186 dostatement, trystatement, statement, line, content, program,
187 production, valuechange, returnstatement,
function, functions, arguments, funcstatement,
188 continuepart, returnpart, callpart, ifstatement, ifblock, whilestatement, breakstatement,
189 openbrace, closebrace, opencurly, closecurly, forstatement, semicolon,
190 condition, catchpart, funcargs, functionarg, emitstatement ;
199 boost::shared_ptr<FunctionGraphBuilder> program_builder;
200 std::vector< FunctionGraphPtr > program_list;
203 std::stack<base::ActionInterface*> for_incr_command;
204 std::string program_text;
205 bool exportf,globalf, parserused;
FunctionGraph::Edge ConditionEdge
A ConditionEdge serves as a token to construct an edge, containing a condition.
boost::shared_ptr< FunctionGraph > FunctionGraphPtr
ProgramInterfacePtr bodyParserResult()
This interface represents the concept of a condition which can be evaluated and return true or false...
A Parser for Orocos Program Scripts.
boost::shared_ptr< ProgramInterface > ProgramInterfacePtr
void initBodyParser(const std::string &name, Service::shared_ptr stck, int offset)
Initialize the bodyParser to parse and store each statement it sees.
This is a parser that you construct to parse a set of arguments.
This class contains some very common parser definitions.
An execution engine serialises (executes one after the other) the execution of all commands...
boost::shared_ptr< Service > shared_ptr
ProgramInterfacePtr programParserResult()
Returns the last program parsed by programParser()
bool parserUsed() const
Returns true if the parser was already used (even partially).
rule_t & programParser()
Returns a program foo {} parser.
How we parse: this parser works like a stack-based RPN calculator.
rule_t & functionParser()
Parses a function foo {} definition.
ProgramGraphParser(iter_t &positer, TaskContext *context, ExecutionEngine *caller, CommonParser &cp)
position_iterator< our_iterator_t > our_pos_iter_t
Get the peer and object from an invocation path like a.b.c.d() .
Based on the software pattern 'command', this interface allows execution of action objects...
rule_t & statementParser()
Parses a single-line statement.
This class is responsible for parsing constant definitions, variable definitions, variable change ins...
rule_t & bodyParser()
Parses a multi-line program, which you can retrieve with bodyParserResult().
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)
The TaskContext is the C++ representation of an Orocos component.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
This is a class containing a parse function for conditions.
boost::adjacency_list< boost::vecS, boost::listS, boost::directedS, VertProperty, EdgeProperty > Graph
FunctionGraph::Vertex CommandNode
A CommandNode serves as a token to construct a vertex or node, containing a command.