Orocos Real-Time Toolkit  2.9.0
ScriptParser.hpp
Go to the documentation of this file.
1 #ifndef RTT_SCRIPTING_PARSER_HPP
2 #define RTT_SCRIPTING_PARSER_HPP
3 
4 #include "parser-types.hpp"
5 
6 #include <map>
7 #include <string>
8 #include <boost/function.hpp>
9 #include <boost/shared_ptr.hpp>
10 #include "../internal/DataSource.hpp"
11 #include "../Service.hpp"
12 
13 namespace RTT
14 {
15  namespace scripting
16  {
17 
22  {
23  // Our task we are parsing in :
24  TaskContext* context;
25  // The task that will execute it:
26  ExecutionEngine* caller;
27  // The storage for top-level variables
28  Service::shared_ptr storage;
29  our_pos_iter_t& mpositer;
30  our_pos_iter_t saveStartPos;
31  // running offset
32  int ln_offset;
33  std::string program_text;
34 
35  rule_t production;
36  rule_t statement;
37  rule_t program;
38  rule_t function;
39  rule_t statemachine;
40 
41  CommonParser* commonparser;
42  StateGraphParser* stateparser;
43  ProgramGraphParser* programparser;
44  ProgramGraphParser* statementparser;
45 
46  void clear();
47 
48  void seenstatement();
49  void seenprogram();
50  void seenfunction();
51  void seenstatemachine();
52 
53  error_status<> handle_no_function(scanner_t const& scan, parser_error<std::string, iter_t>&e );
54 
55  public:
61  ScriptParser(iter_t& positer, TaskContext* tc, ExecutionEngine* caller);
62  ~ScriptParser();
63 
70  void parse(iter_t& begin, iter_t end);
71 
82  iter_t end);
83 
84  };
85  }
86 }
87 
88 #endif
This is not a parser in the Boost.spirit sense of the word, it&#39;s just a class used to hold the parser...
base::DataSourceBase::shared_ptr parseExcerpt(iter_t &begin, iter_t end)
Parses and executes a (possibly) incomplete script.
void parse(iter_t &begin, iter_t end)
Parses and executes the script from begin to end.
A Parser for Orocos Program Scripts.
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
Definition: Service.hpp:101
ScriptParser(iter_t &positer, TaskContext *tc, ExecutionEngine *caller)
Initialize with an initial position, the TaskContext in which context to parse the scripts and the Ta...
scanner< iter_t, scanner_pol_t > scanner_t
position_iterator< our_iterator_t > our_pos_iter_t
rule< scanner_t > rule_t
The TaskContext is the C++ representation of an Orocos component.
Definition: TaskContext.hpp:93
Parsers and executes any RTT script you throw at it.
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52
our_pos_iter_t iter_t