OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
Statement Class Referenceabstract

Interface for statements. More...

#include <Statement.h>

Inheritance diagram for Statement:
Collaboration diagram for Statement:

Public Types

typedef std::list< TokenTokenList
 The type of the enclosed token list.

Public Member Functions

 Statement (const std::string &name, int line)
 Constructor.
 Statement (const std::string &name, TokenList &)
 Constructor.
virtual ~Statement ()
void append (const Token &)
 Append a token.
bool atEnd () const
 Test for end of command.
bool boolean (bool &value)
 Return boolean value.
bool delimiter (char c)
 Test for delimiter.
bool delimiter (const char *s)
 Test for delimiter choice.
virtual void execute (const Parser &)=0
 Execute.
TokengetCurrent ()
 Return current token and skip it.
bool integer (int &value)
 Return signed integer.
bool integer (unsigned &value)
 Return unsigned integer.
bool keyword (const char *s)
 Test for keyword.
bool real (double &value)
 Return real value.
bool str (std::string &value)
 Return string value.
bool word (std::string &value)
 Return word value.
void mark ()
 Mark position in command.
void restore ()
 Return to marked position.
void start ()
 Return to start.
void skip ()
 Skip.
unsigned int position () const
 Return current character number in line.
virtual void print (std::ostream &os) const
 Print statement.
virtual void printWhere (Inform &msg, bool withToken) const
 Print position.
std::string str () const

Protected Attributes

int stat_line
std::string buffer_name
TokenList tokens
TokenList::iterator curr
TokenList::iterator keep

Detailed Description

Interface for statements.

Definition at line 38 of file Statement.h.

Member Typedef Documentation

◆ TokenList

typedef std::list<Token> Statement::TokenList

The type of the enclosed token list.

Definition at line 43 of file Statement.h.

Constructor & Destructor Documentation

◆ Statement() [1/2]

Statement::Statement ( const std::string & name,
int line )

◆ Statement() [2/2]

Statement::Statement ( const std::string & name,
TokenList & list )

Constructor.

Definition at line 33 of file Statement.cpp.

References buffer_name, curr, name, stat_line, and tokens.

◆ ~Statement()

Statement::~Statement ( )
virtual

Definition at line 40 of file Statement.cpp.

References tokens.

Member Function Documentation

◆ append()

void Statement::append ( const Token & token)

◆ atEnd()

bool Statement::atEnd ( ) const

◆ boolean()

bool Statement::boolean ( bool & value)

Return boolean value.

Definition at line 55 of file Statement.cpp.

References curr, tokens, and word().

Referenced by Expressions::parseRelation().

Here is the call graph for this function:

◆ delimiter() [1/2]

◆ delimiter() [2/2]

bool Statement::delimiter ( const char * s)

Test for delimiter choice.

Definition at line 111 of file Statement.cpp.

References curr, and tokens.

◆ execute()

virtual void Statement::execute ( const Parser & )
pure virtual

◆ getCurrent()

Token & Statement::getCurrent ( )

◆ integer() [1/2]

bool Statement::integer ( int & value)

Return signed integer.

Definition at line 79 of file Statement.cpp.

References curr, and tokens.

Referenced by List::list(), and Line::parseList().

◆ integer() [2/2]

bool Statement::integer ( unsigned & value)

Return unsigned integer.

Definition at line 90 of file Statement.cpp.

References curr, and tokens.

◆ keyword()

◆ mark()

void Statement::mark ( )

Mark position in command.

Definition at line 170 of file Statement.cpp.

References curr, and keep.

Referenced by OpalParser::parse(), OpalParser::parseMacro(), Expressions::parseRelation(), Object::parseShortcut(), and Expressions::parseTokenList().

◆ position()

unsigned int Statement::position ( ) const

Return current character number in line.

Definition at line 190 of file Statement.cpp.

References c, curr, and tokens.

Referenced by OpalParser::parse(), and OpalParser::parseEnd().

◆ print()

void Statement::print ( std::ostream & os) const
virtual

Print statement.

Definition at line 204 of file Statement.cpp.

References c, and tokens.

Referenced by IfStatement::execute(), WhileStatement::execute(), operator<<(), operator<<(), OpalParser::parse(), OpalParser::parseEnd(), and str().

◆ printWhere()

void Statement::printWhere ( Inform & msg,
bool withToken ) const
virtual

Print position.

Definition at line 217 of file Statement.cpp.

References buffer_name, curr, endl(), stat_line, and tokens.

Referenced by OpalParser::readStatement().

Here is the call graph for this function:

◆ real()

bool Statement::real ( double & value)

Return real value.

Definition at line 131 of file Statement.cpp.

References curr, and tokens.

Referenced by Expressions::parseArrayPrimary(), and Expressions::parsePrimary().

◆ restore()

void Statement::restore ( )

Return to marked position.

Definition at line 175 of file Statement.cpp.

References curr, and keep.

Referenced by OpalParser::parse(), OpalParser::parseMacro(), Expressions::parseRelation(), and Expressions::parseTokenList().

◆ skip()

void Statement::skip ( )

Skip.

Definition at line 185 of file Statement.cpp.

References atEnd(), and curr.

Here is the call graph for this function:

◆ start()

◆ str() [1/2]

std::string Statement::str ( ) const

Definition at line 232 of file Statement.cpp.

References print(), and str().

Here is the call graph for this function:

◆ str() [2/2]

bool Statement::str ( std::string & value)

Return string value.

Definition at line 148 of file Statement.cpp.

References curr, and tokens.

Referenced by Expressions::parseString(), Expressions::parseStringValue(), and str().

◆ word()

bool Statement::word ( std::string & value)

Return word value.

Definition at line 159 of file Statement.cpp.

References curr, and tokens.

Referenced by boolean(), Expressions::parseRelation(), Object::parseShortcut(), Expressions::parseString(), and Expressions::parseStringValue().

Member Data Documentation

◆ buffer_name

std::string Statement::buffer_name
protected

◆ curr

◆ keep

TokenList::iterator Statement::keep
protected

Definition at line 181 of file Statement.h.

Referenced by SimpleStatement::execute(), WhileStatement::execute(), mark(), and restore().

◆ stat_line

int Statement::stat_line
protected

◆ tokens


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