OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Public Types | Public Member Functions | Protected Attributes | List of all members
Statement Class Referenceabstract

Interface for statements. More...

#include <Statement.h>

Inheritance diagram for Statement:
Inheritance graph
[legend]

Public Types

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

Public Member Functions

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

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

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::Statement ( const std::string &  name,
int  line 
)

Constructor.

Definition at line 30 of file Statement.cpp.

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

Constructor.

Definition at line 35 of file Statement.cpp.

References curr, and tokens.

Statement::~Statement ( )
virtual

Definition at line 42 of file Statement.cpp.

References tokens.

Member Function Documentation

void Statement::append ( const Token token)
bool Statement::atEnd ( ) const
bool Statement::boolean ( bool &  value)

Return boolean value.

Definition at line 57 of file Statement.cpp.

References curr, tokens, and word().

Referenced by Expressions::parseRelation().

Here is the call graph for this function:

bool Statement::delimiter ( char  c)
bool Statement::delimiter ( const char *  s)

Test for delimiter choice.

Definition at line 113 of file Statement.cpp.

References curr, and tokens.

virtual void Statement::execute ( const Parser )
pure virtual
Token & Statement::getCurrent ( )
bool Statement::integer ( int &  value)

Return signed integer.

Definition at line 81 of file Statement.cpp.

References curr, and tokens.

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

bool Statement::integer ( unsigned &  value)

Return unsigned integer.

Definition at line 92 of file Statement.cpp.

References curr, and tokens.

bool Statement::keyword ( const char *  s)
void Statement::mark ( )

Mark position in command.

Definition at line 172 of file Statement.cpp.

References curr, and keep.

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

unsigned int Statement::position ( ) const

Return current character number in line.

Definition at line 192 of file Statement.cpp.

References Physics::c, curr, and tokens.

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

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

Print statement.

Definition at line 206 of file Statement.cpp.

References Physics::c, endl(), and tokens.

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

Here is the call graph for this function:

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

Print position.

Definition at line 219 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:

bool Statement::real ( double &  value)

Return real value.

Definition at line 133 of file Statement.cpp.

References curr, and tokens.

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

void Statement::restore ( )

Return to marked position.

Definition at line 177 of file Statement.cpp.

References curr, and keep.

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

void Statement::skip ( )

Skip.

Definition at line 187 of file Statement.cpp.

References atEnd(), and curr.

Here is the call graph for this function:

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

Return string value.

Definition at line 150 of file Statement.cpp.

References curr, and tokens.

Referenced by Expressions::parseString().

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

Return word value.

Definition at line 161 of file Statement.cpp.

References curr, and tokens.

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

Member Data Documentation

std::string Statement::buffer_name
protected

Definition at line 175 of file Statement.h.

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

TokenList::iterator Statement::curr
protected
TokenList::iterator Statement::keep
protected

Definition at line 180 of file Statement.h.

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

int Statement::stat_line
protected

Definition at line 172 of file Statement.h.

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

TokenList Statement::tokens
protected

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