Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
RTT::scripting::ProgramGraphParser Class Reference

A Parser for Orocos Program Scripts. More...

#include <ProgramGraphParser.hpp>

Public Member Functions

rule_tbodyParser ()
 
ProgramInterfacePtr bodyParserResult ()
 
rule_tfunctionParser ()
 
void initBodyParser (const std::string &name, Service::shared_ptr stck, int offset)
 
std::vector< ProgramInterfacePtrparse (iter_t &begin, iter_t end)
 Tries to parse programs, returns the generated programs on success. More...
 
std::vector< ProgramInterfacePtrparseFunction (iter_t &begin, iter_t end)
 
bool parserUsed () const
 
 ProgramGraphParser (iter_t &positer, TaskContext *context, ExecutionEngine *caller, CommonParser &cp)
 
rule_tprogramParser ()
 
ProgramInterfacePtr programParserResult ()
 
rule_tstatementParser ()
 
 ~ProgramGraphParser ()
 

Private Types

typedef FunctionGraphBuilder::CommandNode CommandNode
 
typedef FunctionGraphBuilder::ConditionEdge ConditionEdge
 
typedef std::map< std::string, FunctionGraphPtrfuncmap
 
typedef FunctionGraphBuilder::Graph Graph
 

Private Member Functions

void cleanup (bool remove_service)
 
void clearParseState ()
 Clears helper variables of parser. More...
 
void endforstatement ()
 
void endifblock ()
 
void endifstatement ()
 
void endwhilestatement ()
 
void exportdef ()
 
void functiondef (iter_t begin, iter_t end)
 
void globaldef ()
 
void noskip_eol ()
 
void programdef (iter_t begin, iter_t end)
 
void programtext (iter_t, iter_t)
 
void seenbreakstatement ()
 
void seencallfuncargs ()
 
void seencallfunclabel (iter_t begin, iter_t end)
 
void seencallfuncstatement ()
 
void seencatchpart ()
 
void seencondition ()
 
void seencontinue ()
 
void seenemptyforincr ()
 
void seenforincr ()
 
void seenforinit ()
 
void seenforinit_expr ()
 
void seenforstatement ()
 
void seenfuncidentifier (iter_t begin, iter_t end)
 
void seenfunctionarg ()
 
void seenfunctionend ()
 
void seenifstatement ()
 
void seenprogramend ()
 
void seenreturnlabel ()
 
void seenreturnstatement ()
 
void seenreturntype (iter_t begin, iter_t end)
 
void seenreturnvalue ()
 
void seenstatement ()
 
void seentrystatement ()
 
void seenvalidinput ()
 
void seenvaluechange ()
 
void seenwhilestatement ()
 
void seenyield ()
 
void setStack (Service::shared_ptr st)
 
void setup ()
 
void setup2 ()
 
void skip_eol ()
 
void startcatchpart ()
 
void startofprogram ()
 

Private Attributes

rule_t andpart
 
ArgumentsParserargsparser
 
rule_t arguments
 
rule_t breakstatement
 
std::vector< base::DataSourceBase::shared_ptrcallfnargs
 
rule_t callpart
 
rule_t catchpart
 
rule_t closebrace
 
rule_t closecurly
 
CommonParsercommonparser
 
rule_t condition
 
ConditionParser conditionparser
 
rule_t content
 
Service::shared_ptr context
 
rule_t continuepart
 
rule_t dostatement
 
rule_t emitstatement
 
bool exportf
 
ExpressionParser expressionparser
 
Service::shared_ptr fcontext
 
std::stack< base::ActionInterface * > for_incr_command
 
base::ActionInterfacefor_init_command
 
rule_t forstatement
 
rule_t funcargs
 
rule_t funcstatement
 
rule_t function
 
rule_t functionarg
 
rule_t functions
 
bool globalf
 
rule_t ifblock
 
rule_t ifstatement
 
ConditionInterfaceimplcond
 
std::vector< ConditionInterface * > implcond_v
 
rule_t jumpdestination
 
rule_t line
 
int ln_offset
 
FunctionGraphPtr mcallfunc
 
ConditionInterfacemcondition
 
FunctionGraphPtr mfunc
 
funcmap mfuncs
 
our_pos_iter_tmpositer
 
rule_t newline
 
rule_t openbrace
 
rule_t opencurly
 
bool parserused
 
TaskContextpeer
 
PeerParser peerparser
 
rule_t production
 
rule_t program
 
boost::shared_ptr< FunctionGraphBuilderprogram_builder
 
std::vector< FunctionGraphPtrprogram_list
 
std::string program_text
 
std::string rettype
 
rule_t returnpart
 
rule_t returnstatement
 
TaskContextrootc
 
rule_t semicolon
 
rule_t statement
 
rule_t terminationclause
 
rule_t terminationpart
 
ConditionInterfacetry_cond
 
rule_t trystatement
 
rule_t valuechange
 
ValueChangeParser valuechangeparser
 
rule_t whilestatement
 

Detailed Description

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.

Member Typedef Documentation

Definition at line 74 of file ProgramGraphParser.hpp.

Definition at line 75 of file ProgramGraphParser.hpp.

typedef std::map<std::string, FunctionGraphPtr> RTT::scripting::ProgramGraphParser::funcmap
private

Definition at line 108 of file ProgramGraphParser.hpp.

Definition at line 76 of file ProgramGraphParser.hpp.

Constructor & Destructor Documentation

RTT::ProgramGraphParser::ProgramGraphParser ( iter_t positer,
TaskContext context,
ExecutionEngine caller,
CommonParser cp 
)

Definition at line 95 of file ProgramGraphParser.cpp.

RTT::ProgramGraphParser::~ProgramGraphParser ( )

Definition at line 115 of file ProgramGraphParser.cpp.

Member Function Documentation

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 243 of file ProgramGraphParser.cpp.

ProgramInterfacePtr RTT::ProgramGraphParser::bodyParserResult ( )

Definition at line 266 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::cleanup ( bool  remove_service)
private

Definition at line 795 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::clearParseState ( )
private

Clears helper variables of parser.

Definition at line 295 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::endforstatement ( )
private

Definition at line 663 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::endifblock ( )
private

Definition at line 580 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::endifstatement ( )
private

Definition at line 585 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::endwhilestatement ( )
private

Definition at line 602 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::exportdef ( )
private

Definition at line 329 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::functiondef ( iter_t  begin,
iter_t  end 
)
private

Definition at line 343 of file ProgramGraphParser.cpp.

rule_t & RTT::ProgramGraphParser::functionParser ( )

Parses a function foo {} definition.

Definition at line 239 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::globaldef ( )
private

Definition at line 334 of file ProgramGraphParser.cpp.

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 227 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::noskip_eol ( )
private

Definition at line 549 of file ProgramGraphParser.cpp.

std::vector< ProgramInterfacePtr > RTT::ProgramGraphParser::parse ( iter_t begin,
iter_t  end 
)

Tries to parse programs, returns the generated programs on success.

Exceptions
file_parse_exceptionThe parser found an error.

Definition at line 690 of file ProgramGraphParser.cpp.

std::vector< ProgramInterfacePtr > RTT::ProgramGraphParser::parseFunction ( iter_t begin,
iter_t  end 
)

Definition at line 744 of file ProgramGraphParser.cpp.

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 286 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::programdef ( iter_t  begin,
iter_t  end 
)
private

Definition at line 305 of file ProgramGraphParser.cpp.

rule_t & RTT::ProgramGraphParser::programParser ( )

Returns a program foo {} parser.

Definition at line 235 of file ProgramGraphParser.cpp.

ProgramInterfacePtr RTT::ProgramGraphParser::programParserResult ( )

Returns the last program parsed by programParser()

Definition at line 253 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::programtext ( iter_t  begin,
iter_t  end 
)
private

Definition at line 323 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenbreakstatement ( )
private

Definition at line 477 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seencallfuncargs ( )
private

Definition at line 504 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seencallfunclabel ( iter_t  begin,
iter_t  end 
)
private

Definition at line 927 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seencallfuncstatement ( )
private

Definition at line 509 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seencatchpart ( )
private

Definition at line 561 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seencondition ( )
private

Definition at line 437 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seencontinue ( )
private

Definition at line 940 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenemptyforincr ( )
private

Definition at line 638 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenforincr ( )
private

Definition at line 631 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenforinit ( )
private

Definition at line 607 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenforinit_expr ( )
private

Definition at line 624 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenforstatement ( )
private

Definition at line 643 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenfuncidentifier ( iter_t  begin,
iter_t  end 
)
private

Definition at line 486 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenfunctionarg ( )
private

Definition at line 382 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenfunctionend ( )
private

Definition at line 391 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenifstatement ( )
private

Definition at line 566 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenprogramend ( )
private

Definition at line 678 of file ProgramGraphParser.cpp.

void RTT::scripting::ProgramGraphParser::seenreturnlabel ( )
private
void RTT::ProgramGraphParser::seenreturnstatement ( )
private

Definition at line 450 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenreturntype ( iter_t  begin,
iter_t  end 
)
private

Definition at line 339 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenreturnvalue ( )
private

Definition at line 457 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenstatement ( )
private

Definition at line 865 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seentrystatement ( )
private

Definition at line 837 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenvalidinput ( )
private

Definition at line 433 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenvaluechange ( )
private

Definition at line 891 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenwhilestatement ( )
private

Definition at line 589 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::seenyield ( )
private

Definition at line 884 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::setStack ( Service::shared_ptr  st)
private

Definition at line 290 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::setup ( )
private

Definition at line 122 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::setup2 ( )
private

Definition at line 63 of file ProgramGraphParser2.cpp.

void RTT::ProgramGraphParser::skip_eol ( )
private

Definition at line 545 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::startcatchpart ( )
private

Definition at line 553 of file ProgramGraphParser.cpp.

void RTT::ProgramGraphParser::startofprogram ( )
private

Definition at line 301 of file ProgramGraphParser.cpp.

rule_t & RTT::ProgramGraphParser::statementParser ( )

Parses a single-line statement.

Definition at line 248 of file ProgramGraphParser.cpp.

Member Data Documentation

rule_t RTT::scripting::ProgramGraphParser::andpart
private

Definition at line 185 of file ProgramGraphParser.hpp.

ArgumentsParser* RTT::scripting::ProgramGraphParser::argsparser
private

Definition at line 196 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::arguments
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::breakstatement
private

Definition at line 185 of file ProgramGraphParser.hpp.

std::vector<base::DataSourceBase::shared_ptr> RTT::scripting::ProgramGraphParser::callfnargs
private

Definition at line 118 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::callpart
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::catchpart
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::closebrace
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::closecurly
private

Definition at line 185 of file ProgramGraphParser.hpp.

CommonParser& RTT::scripting::ProgramGraphParser::commonparser
private

Definition at line 192 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::condition
private

Definition at line 185 of file ProgramGraphParser.hpp.

ConditionParser RTT::scripting::ProgramGraphParser::conditionparser
private

Definition at line 193 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::content
private

Definition at line 185 of file ProgramGraphParser.hpp.

Service::shared_ptr RTT::scripting::ProgramGraphParser::context
private

The current subcontext of root where we are working in.

Definition at line 87 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::continuepart
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::dostatement
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::emitstatement
private

Definition at line 185 of file ProgramGraphParser.hpp.

bool RTT::scripting::ProgramGraphParser::exportf
private

Definition at line 205 of file ProgramGraphParser.hpp.

ExpressionParser RTT::scripting::ProgramGraphParser::expressionparser
private

Definition at line 195 of file ProgramGraphParser.hpp.

Service::shared_ptr RTT::scripting::ProgramGraphParser::fcontext
private

The current function context where we are working in.

Definition at line 92 of file ProgramGraphParser.hpp.

std::stack<base::ActionInterface*> RTT::scripting::ProgramGraphParser::for_incr_command
private

Definition at line 203 of file ProgramGraphParser.hpp.

base::ActionInterface* RTT::scripting::ProgramGraphParser::for_init_command
private

Definition at line 202 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::forstatement
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::funcargs
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::funcstatement
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::function
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::functionarg
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::functions
private

Definition at line 185 of file ProgramGraphParser.hpp.

bool RTT::scripting::ProgramGraphParser::globalf
private

Definition at line 205 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::ifblock
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::ifstatement
private

Definition at line 185 of file ProgramGraphParser.hpp.

ConditionInterface* RTT::scripting::ProgramGraphParser::implcond
private

Definition at line 116 of file ProgramGraphParser.hpp.

std::vector<ConditionInterface*> RTT::scripting::ProgramGraphParser::implcond_v
private

Definition at line 117 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::jumpdestination
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::line
private

Definition at line 185 of file ProgramGraphParser.hpp.

int RTT::scripting::ProgramGraphParser::ln_offset
private

Definition at line 206 of file ProgramGraphParser.hpp.

FunctionGraphPtr RTT::scripting::ProgramGraphParser::mcallfunc
private

Definition at line 105 of file ProgramGraphParser.hpp.

ConditionInterface* RTT::scripting::ProgramGraphParser::mcondition
private

Definition at line 121 of file ProgramGraphParser.hpp.

FunctionGraphPtr RTT::scripting::ProgramGraphParser::mfunc
private

Definition at line 102 of file ProgramGraphParser.hpp.

funcmap RTT::scripting::ProgramGraphParser::mfuncs
private

Definition at line 109 of file ProgramGraphParser.hpp.

our_pos_iter_t& RTT::scripting::ProgramGraphParser::mpositer
private

Definition at line 99 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::newline
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::openbrace
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::opencurly
private

Definition at line 185 of file ProgramGraphParser.hpp.

bool RTT::scripting::ProgramGraphParser::parserused
private

Definition at line 205 of file ProgramGraphParser.hpp.

TaskContext* RTT::scripting::ProgramGraphParser::peer
private

peer context for events.

Definition at line 97 of file ProgramGraphParser.hpp.

PeerParser RTT::scripting::ProgramGraphParser::peerparser
private

Definition at line 197 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::production
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::program
private

Definition at line 185 of file ProgramGraphParser.hpp.

boost::shared_ptr<FunctionGraphBuilder> RTT::scripting::ProgramGraphParser::program_builder
private

Definition at line 199 of file ProgramGraphParser.hpp.

std::vector< FunctionGraphPtr > RTT::scripting::ProgramGraphParser::program_list
private

Definition at line 200 of file ProgramGraphParser.hpp.

std::string RTT::scripting::ProgramGraphParser::program_text
private

Definition at line 204 of file ProgramGraphParser.hpp.

std::string RTT::scripting::ProgramGraphParser::rettype
private

Definition at line 112 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::returnpart
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::returnstatement
private

Definition at line 185 of file ProgramGraphParser.hpp.

TaskContext* RTT::scripting::ProgramGraphParser::rootc
private

The context given to us by the user to root the parsed programs into.

Definition at line 82 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::semicolon
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::statement
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::terminationclause
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::terminationpart
private

Definition at line 185 of file ProgramGraphParser.hpp.

ConditionInterface* RTT::scripting::ProgramGraphParser::try_cond
private

Definition at line 123 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::trystatement
private

Definition at line 185 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::valuechange
private

Definition at line 185 of file ProgramGraphParser.hpp.

ValueChangeParser RTT::scripting::ProgramGraphParser::valuechangeparser
private

Definition at line 194 of file ProgramGraphParser.hpp.

rule_t RTT::scripting::ProgramGraphParser::whilestatement
private

Definition at line 185 of file ProgramGraphParser.hpp.


The documentation for this class was generated from the following files:


rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:46