OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
IfStatement Class Reference

If statement. More...

#include <IfStatement.h>

Inheritance diagram for IfStatement:
Inheritance graph
Collaboration diagram for IfStatement:
Collaboration graph

Public Types

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

Public Member Functions

 IfStatement (const Parser &, TokenStream &)
 Constructor.
 
virtual ~IfStatement ()
 
virtual void execute (const Parser &)
 Execute.
 
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.
 
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.
 
std::string str () const
 
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.
 

Protected Attributes

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

Private Member Functions

 IfStatement ()
 
 IfStatement (const IfStatement &)
 
void operator= (const IfStatement &)
 

Private Attributes

Statementthen_block
 
Statementelse_block
 

Detailed Description

If statement.

Definition at line 34 of file IfStatement.h.

Member Typedef Documentation

◆ TokenList

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

The type of the enclosed token list.

Definition at line 40 of file Statement.h.

Constructor & Destructor Documentation

◆ IfStatement() [1/3]

IfStatement::IfStatement ( const Parser parser,
TokenStream is 
)

Constructor.

Definition at line 35 of file IfStatement.cpp.

References Statement::append(), else_block, Token::isDel(), Token::isEOF(), Token::isKey(), TokenStream::putBack(), Parser::readStatement(), TokenStream::readToken(), and then_block.

Here is the call graph for this function:

◆ ~IfStatement()

IfStatement::~IfStatement ( )
virtual

Definition at line 71 of file IfStatement.cpp.

References else_block, and then_block.

◆ IfStatement() [2/3]

IfStatement::IfStatement ( )
private

◆ IfStatement() [3/3]

IfStatement::IfStatement ( const IfStatement )
private

Member Function Documentation

◆ append()

void Statement::append ( const Token token)
inherited

◆ atEnd()

bool Statement::atEnd ( ) const
inherited

◆ boolean()

bool Statement::boolean ( bool &  value)
inherited

Return boolean value.

Definition at line 43 of file Statement.cpp.

References Statement::curr, Statement::tokens, and Statement::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)
inherited

Test for delimiter choice.

Definition at line 92 of file Statement.cpp.

References Statement::curr, and Statement::tokens.

◆ execute()

void IfStatement::execute ( const Parser parser)
virtual

◆ getCurrent()

Token & Statement::getCurrent ( )
inherited

◆ integer() [1/2]

bool Statement::integer ( int &  value)
inherited

Return signed integer.

Definition at line 63 of file Statement.cpp.

References Statement::curr, Token::getInteger(), and Statement::tokens.

Referenced by Line::parseList().

Here is the call graph for this function:

◆ integer() [2/2]

bool Statement::integer ( unsigned &  value)
inherited

Return unsigned integer.

Definition at line 73 of file Statement.cpp.

References Statement::curr, and Statement::tokens.

◆ keyword()

◆ mark()

void Statement::mark ( )
inherited

◆ operator=()

void IfStatement::operator= ( const IfStatement )
private

◆ position()

unsigned int Statement::position ( ) const
inherited

Return current character number in line.

Definition at line 157 of file Statement.cpp.

References Statement::curr, and Statement::tokens.

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

◆ print()

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

◆ printWhere()

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

Print position.

Definition at line 183 of file Statement.cpp.

References Statement::buffer_name, Statement::curr, Statement::stat_line, and Statement::tokens.

◆ real()

bool Statement::real ( double &  value)
inherited

Return real value.

Definition at line 110 of file Statement.cpp.

References Statement::curr, and Statement::tokens.

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

◆ restore()

void Statement::restore ( )
inherited

Return to marked position.

Definition at line 148 of file Statement.cpp.

References Statement::curr, and Statement::keep.

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

◆ skip()

void Statement::skip ( )
inherited

Skip.

Definition at line 152 of file Statement.cpp.

References Statement::atEnd(), and Statement::curr.

Here is the call graph for this function:

◆ start()

◆ str() [1/2]

std::string Statement::str ( ) const
inherited

Definition at line 197 of file Statement.cpp.

References Statement::print(), and Statement::str().

Referenced by Statement::str().

Here is the call graph for this function:

◆ str() [2/2]

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

Return string value.

Definition at line 126 of file Statement.cpp.

References Statement::curr, and Statement::tokens.

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

◆ word()

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

Member Data Documentation

◆ buffer_name

std::string Statement::buffer_name
protectedinherited

Definition at line 173 of file Statement.h.

Referenced by CompoundStatement::CompoundStatement(), and Statement::printWhere().

◆ curr

◆ else_block

Statement* IfStatement::else_block
private

Definition at line 53 of file IfStatement.h.

Referenced by execute(), IfStatement(), and ~IfStatement().

◆ keep

TokenList::iterator Statement::keep
protectedinherited

◆ stat_line

int Statement::stat_line
protectedinherited

Definition at line 170 of file Statement.h.

Referenced by CompoundStatement::CompoundStatement(), and Statement::printWhere().

◆ then_block

Statement* IfStatement::then_block
private

Definition at line 52 of file IfStatement.h.

Referenced by execute(), IfStatement(), and ~IfStatement().

◆ tokens


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