OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
OpalParser Class Reference

The default parser for OPAL-9. More...

#include <OpalParser.h>

Inheritance diagram for OpalParser:
Collaboration diagram for OpalParser:

Public Member Functions

 OpalParser ()
virtual ~OpalParser ()
virtual void parse (Statement &) const
 Parse and execute current statement.
virtual StatementreadStatement (TokenStream *) const
 Read complete statement from a token stream.
virtual void run () const
 Read current stream.
virtual void run (TokenStream *) const
 Read given stream.
void stop () const
 Set stop flag.

Static Public Member Functions

static Token readToken ()
 Return next input token.

Protected Member Functions

void execute (Object *, const std::string &) const
 Execute or check the current command.
virtual Objectfind (const std::string &) const
 Find object by name in the main directory.
virtual void parseAction (Statement &) const
 Parse executable command.
virtual void parseAssign (Statement &) const
 Parse assignment statement.
virtual void parseDefine (Statement &) const
 Parse definition.
virtual void parseEnd (Statement &) const
 Check for end of statement.
virtual void parseMacro (const std::string &name, Statement &) const
 Parse macro definition or call.
virtual void printHelp (const std::string &) const
 Print help on named command.

Private Member Functions

 OpalParser (const OpalParser &)
void operator= (const OpalParser &)

Static Private Member Functions

static void parseBracketList (char close, Statement &)
static void parseTokenList (Statement &)
static std::string getHint (const std::string &, const std::string &="attribute")

Private Attributes

bool stopFlag

Static Private Attributes

static std::vector< std::shared_ptr< TokenStream > > inputStack

Detailed Description

The default parser for OPAL-9.

Definition at line 44 of file OpalParser.h.

Constructor & Destructor Documentation

◆ OpalParser() [1/2]

OpalParser::OpalParser ( )

Definition at line 57 of file OpalParser.cpp.

References stopFlag.

Referenced by OpalParser(), and operator=().

Here is the caller graph for this function:

◆ ~OpalParser()

OpalParser::~OpalParser ( )
virtual

Definition at line 60 of file OpalParser.cpp.

◆ OpalParser() [2/2]

OpalParser::OpalParser ( const OpalParser & )
private

References OpalParser().

Here is the call graph for this function:

Member Function Documentation

◆ execute()

void OpalParser::execute ( Object * object,
const std::string & name ) const
protected

Execute or check the current command.

Definition at line 119 of file OpalParser.cpp.

References OpalData::getInstance(), gmsg, Options::mtrace, Object::shouldTrace(), Object::shouldUpdate(), and OpalData::update().

Referenced by parseAction(), parseDefine(), and parseMacro().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find()

Object * OpalParser::find ( const std::string & name) const
protectedvirtual

Find object by name in the main directory.

Reimplemented in TrackParser.

Definition at line 143 of file OpalParser.cpp.

References OpalData::find(), and OpalData::getInstance().

Referenced by parse(), parseAction(), parseAssign(), parseDefine(), parseMacro(), SequenceParser::parseMember(), and printHelp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHint()

std::string OpalParser::getHint ( const std::string & name,
const std::string & type = "attribute" )
staticprivate

Definition at line 620 of file OpalParser.cpp.

References AttributeHandler::COMMAND, AttributeHandler::ELEMENT, AttributeHandler::getOwner(), AttributeHandler::STATEMENT, and AttributeHandler::SUB_COMMAND.

Referenced by parse(), and parseAction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

void OpalParser::operator= ( const OpalParser & )
private

References OpalParser().

Here is the call graph for this function:

◆ parse()

void OpalParser::parse ( Statement & stat) const
virtual

Parse and execute current statement.

Implements Parser.

Reimplemented in SequenceParser.

Definition at line 63 of file OpalParser.cpp.

References Statement::atEnd(), Statement::delimiter(), find(), Statement::getCurrent(), getHint(), OpalData::getInstance(), Token::getLex(), Statement::keyword(), Statement::mark(), parseAction(), parseAssign(), parseDefine(), parseMacro(), Expressions::parseString(), Statement::position(), Statement::print(), printHelp(), Statement::restore(), and Statement::start().

Here is the call graph for this function:

◆ parseAction()

void OpalParser::parseAction ( Statement & stat) const
protectedvirtual

Parse executable command.

Definition at line 147 of file OpalParser.cpp.

References Object::clone(), Statement::delimiter(), execute(), find(), getHint(), Object::parse(), parseEnd(), Expressions::parseString(), printHelp(), Statement::start(), and stopFlag.

Referenced by parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseAssign()

void OpalParser::parseAssign ( Statement & stat) const
protectedvirtual

Parse assignment statement.

Definition at line 180 of file OpalParser.cpp.

References Object::clone(), OpalData::define(), Statement::delimiter(), OpalData::find(), find(), Object::findAttribute(), OpalData::getInstance(), Object::isTreeMember(), Statement::keyword(), OpalData::makeDirty(), Expressions::parseDelimiter(), parseEnd(), Expressions::parseRealConst(), Expressions::parseString(), and Statement::start().

Referenced by parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseBracketList()

void OpalParser::parseBracketList ( char close,
Statement & stat )
staticprivate

Definition at line 438 of file OpalParser.cpp.

References Statement::append(), Token::isDel(), Token::isEOF(), parseBracketList(), and readToken().

Referenced by parseBracketList(), parseTokenList(), and readStatement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseDefine()

void OpalParser::parseDefine ( Statement & stat) const
protectedvirtual

Parse definition.

Definition at line 313 of file OpalParser.cpp.

References Object::clone(), OpalData::define(), Statement::delimiter(), execute(), find(), OpalData::getInstance(), Statement::keyword(), Object::makeInstance(), Object::parse(), parseEnd(), Expressions::parseString(), Object::setShared(), and Statement::start().

Referenced by parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseEnd()

void OpalParser::parseEnd ( Statement & stat) const
protectedvirtual

Check for end of statement.

Definition at line 360 of file OpalParser.cpp.

References Statement::atEnd(), Statement::delimiter(), Statement::position(), and Statement::print().

Referenced by SequenceParser::parse(), parseAction(), parseAssign(), parseDefine(), and SequenceParser::parseMember().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseMacro()

void OpalParser::parseMacro ( const std::string & name,
Statement & stat ) const
protectedvirtual

Parse macro definition or call.

Definition at line 373 of file OpalParser.cpp.

References OpalData::define(), Statement::delimiter(), execute(), find(), Statement::getCurrent(), OpalData::getInstance(), inputStack, Object::makeInstance(), Object::makeTemplate(), Statement::mark(), Expressions::parseString(), and Statement::restore().

Referenced by parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseTokenList()

void OpalParser::parseTokenList ( Statement & stat)
staticprivate

Definition at line 458 of file OpalParser.cpp.

References Statement::append(), Token::isDel(), Token::isEOF(), parseBracketList(), and readToken().

Referenced by readStatement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printHelp()

void OpalParser::printHelp ( const std::string & cmdName) const
protectedvirtual

Print help on named command.

Definition at line 428 of file OpalParser.cpp.

References find(), and gmsg.

Referenced by parse(), and parseAction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readStatement()

Statement * OpalParser::readStatement ( TokenStream * is) const
virtual

Read complete statement from a token stream.

Todo
check this /stat->printWhere(*IpplInfo::Error, true);

Implements Parser.

Definition at line 487 of file OpalParser.cpp.

References Statement::append(), Token::getFile(), Token::getLine(), gmsg, inputStack, Token::isDel(), Token::isEOF(), Token::isKey(), Token::isString(), Token::isWord(), parseBracketList(), parseTokenList(), readStatement(), TokenStream::readToken(), Statement::start(), and ClassicException::what().

Referenced by readStatement(), and run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readToken()

Token OpalParser::readToken ( )
static

Return next input token.

Definition at line 479 of file OpalParser.cpp.

References inputStack, and Token::IS_EOF.

Referenced by parseBracketList(), and parseTokenList().

Here is the caller graph for this function:

◆ run() [1/2]

void OpalParser::run ( ) const
virtual

Read current stream.

Definition at line 581 of file OpalParser.cpp.

References inputStack, readStatement(), stopFlag, ClassicException::what(), and ClassicException::where().

Referenced by Call::execute(), main(), SequenceTemplate::makeInstance(), Sequence::parse(), and run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run() [2/2]

void OpalParser::run ( TokenStream * is) const
virtual

Read given stream.

Implements Parser.

Definition at line 610 of file OpalParser.cpp.

References inputStack, and run().

Here is the call graph for this function:

◆ stop()

void OpalParser::stop ( ) const

Set stop flag.

Definition at line 616 of file OpalParser.cpp.

References stopFlag.

Referenced by SequenceParser::parse().

Here is the caller graph for this function:

Member Data Documentation

◆ inputStack

std::vector< std::shared_ptr< TokenStream > > OpalParser::inputStack
staticprivate

Definition at line 119 of file OpalParser.h.

Referenced by parseMacro(), readStatement(), readToken(), run(), and run().

◆ stopFlag

bool OpalParser::stopFlag
mutableprivate

Definition at line 116 of file OpalParser.h.

Referenced by OpalParser(), parseAction(), run(), and stop().


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