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

The parser for SEQUENCE members. More...

#include <SequenceParser.h>

Inheritance diagram for SequenceParser:
Collaboration diagram for SequenceParser:

Classes

struct  Reference

Public Member Functions

 SequenceParser (Sequence *)
 Constructor.
virtual ~SequenceParser ()
virtual void parse (Statement &) const
 Parse sequence member.
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 Types

typedef std::list< ReferenceRefList
typedef Sequence::TLine TLine

Private Member Functions

 SequenceParser ()
 SequenceParser (const SequenceParser &)
void operator= (const SequenceParser &)
void fillPositions () const
void findFromPositions () const
void findNeighbourPositions () const
void parseMember (Statement &) const
void parsePosition (Statement &, Object &, bool defined) const

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

SequenceitsSequence
bool okFlag
RefList references
TLine itsLine
bool stopFlag

Static Private Attributes

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

Detailed Description

The parser for SEQUENCE members.

Definition at line 40 of file SequenceParser.h.

Member Typedef Documentation

◆ RefList

typedef std::list<Reference> SequenceParser::RefList
private

Definition at line 71 of file SequenceParser.h.

◆ TLine

Definition at line 74 of file SequenceParser.h.

Constructor & Destructor Documentation

◆ SequenceParser() [1/3]

SequenceParser::SequenceParser ( Sequence * seq)

Constructor.

Definition at line 38 of file SequenceParser.cpp.

References itsLine, itsSequence, and okFlag.

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

Here is the caller graph for this function:

◆ ~SequenceParser()

SequenceParser::~SequenceParser ( )
virtual

Definition at line 43 of file SequenceParser.cpp.

◆ SequenceParser() [2/3]

SequenceParser::SequenceParser ( )
private

◆ SequenceParser() [3/3]

SequenceParser::SequenceParser ( const SequenceParser & )
private

References SequenceParser().

Here is the call graph for this function:

Member Function Documentation

◆ execute()

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

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:

◆ fillPositions()

void SequenceParser::fillPositions ( ) const
private

Definition at line 86 of file SequenceParser.cpp.

References SequenceMember::ABSOLUTE, findFromPositions(), findNeighbourPositions(), and references.

Referenced by parse().

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
protectedvirtualinherited

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:

◆ findFromPositions()

void SequenceParser::findFromPositions ( ) const
private

Definition at line 118 of file SequenceParser.cpp.

References itsLine, itsSequence, and references.

Referenced by fillPositions().

Here is the caller graph for this function:

◆ findNeighbourPositions()

void SequenceParser::findNeighbourPositions ( ) const
private

Definition at line 132 of file SequenceParser.cpp.

References SequenceMember::ABSOLUTE, SequenceMember::DRIFT, SequenceMember::END, Element::find(), SequenceParser::Reference::fromPosition, Element::getLength(), Attributes::getReal(), Attributes::getString(), SequenceMember::IMMEDIATE, Element::IS_CENTRE, Element::IS_ENTRY, Element::IS_EXIT, itsLine, itsSequence, SequenceMember::NEXT, SequenceMember::PREVIOUS, and references.

Referenced by fillPositions().

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" )
staticprivateinherited

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 SequenceParser::operator= ( const SequenceParser & )
private

References SequenceParser().

Here is the call graph for this function:

◆ parse()

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

Parse sequence member.

Reimplemented from OpalParser.

Definition at line 47 of file SequenceParser.cpp.

References fillPositions(), OpalData::getInstance(), itsLine, itsSequence, Statement::keyword(), OpalData::makeDirty(), okFlag, OpalParser::parseEnd(), parseMember(), Statement::start(), and OpalParser::stop().

Here is the call graph for this function:

◆ parseAction()

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

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
protectedvirtualinherited

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 )
staticprivateinherited

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
protectedvirtualinherited

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
protectedvirtualinherited

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
protectedvirtualinherited

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:

◆ parseMember()

void SequenceParser::parseMember ( Statement & stat) const
private

Definition at line 235 of file SequenceParser.cpp.

References ElementBase::copyStructure(), OpalData::define(), Statement::delimiter(), OpalParser::find(), OpalData::getInstance(), SequenceMember::GLOBAL, itsLine, itsSequence, SequenceMember::itsType, SequenceMember::LOCAL, SequenceMember::OpalElement, OpalParser::parseEnd(), parsePosition(), Expressions::parseString(), ElmPtr::setElement(), and FlaggedElmPtr::setReflectionFlag().

Referenced by parse().

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

◆ parsePosition()

void SequenceParser::parsePosition ( Statement & stat,
Object & elem,
bool defined ) const
private

Definition at line 319 of file SequenceParser.cpp.

References SequenceMember::ABSOLUTE, Statement::delimiter(), SequenceMember::DRIFT, SequenceMember::END, Object::findAttribute(), SequenceMember::FROM, SequenceParser::Reference::fromName, Object::getOpalName(), SequenceMember::IMMEDIATE, SequenceMember::itsFlag, itsLine, SequenceParser::Reference::itsList, SequenceMember::itsPosition, Statement::keyword(), SequenceMember::NEXT, Expressions::parseDelimiter(), Expressions::parseRealConst(), Expressions::parseString(), SequenceMember::PREVIOUS, and references.

Referenced by parseMember().

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

◆ parseTokenList()

void OpalParser::parseTokenList ( Statement & stat)
staticprivateinherited

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
protectedvirtualinherited

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
virtualinherited

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 ( )
staticinherited

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
virtualinherited

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
virtualinherited

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
inherited

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
staticprivateinherited

Definition at line 119 of file OpalParser.h.

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

◆ itsLine

TLine SequenceParser::itsLine
mutableprivate

◆ itsSequence

Sequence* SequenceParser::itsSequence
private

◆ okFlag

bool SequenceParser::okFlag
mutableprivate

Definition at line 100 of file SequenceParser.h.

Referenced by parse(), and SequenceParser().

◆ references

RefList SequenceParser::references
mutableprivate

◆ stopFlag

bool OpalParser::stopFlag
mutableprivateinherited

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: