|
OPAL (Object Oriented Parallel Accelerator Library)
2024.1
OPAL
|
Interface for statements. More...
#include <Statement.h>

Public Types | |
| typedef std::list< Token > | TokenList |
| 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... | |
| Token & | getCurrent () |
| 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... | |
| std::string | str () const |
Protected Attributes | |
| int | stat_line |
| std::string | buffer_name |
| TokenList | tokens |
| TokenList::iterator | curr |
| TokenList::iterator | keep |
Interface for statements.
Definition at line 38 of file Statement.h.
| typedef std::list<Token> Statement::TokenList |
The type of the enclosed token list.
Definition at line 43 of file Statement.h.
| Statement::Statement | ( | const std::string & | name, |
| int | line | ||
| ) |
Constructor.
Definition at line 28 of file Statement.cpp.
| Statement::Statement | ( | const std::string & | name, |
| TokenList & | list | ||
| ) |
|
virtual |
Definition at line 40 of file Statement.cpp.
References tokens.
Append a token.
Definition at line 45 of file Statement.cpp.
References tokens.
Referenced by IfStatement::IfStatement(), LineTemplate::makeInstance(), OpalParser::parseBracketList(), OpalParser::parseTokenList(), OpalParser::readStatement(), and WhileStatement::WhileStatement().
| bool Statement::atEnd | ( | ) | const |
Test for end of command.
Definition at line 50 of file Statement.cpp.
Referenced by MacroCmd::makeTemplate(), OpalParser::parse(), Expressions::parseBracketList(), OpalParser::parseEnd(), LineTemplate::parseTemplate(), Expressions::parseTokenList(), and skip().
| 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().

| bool Statement::delimiter | ( | char | c | ) |
Test for delimiter.
Definition at line 101 of file Statement.cpp.
Referenced by List::list(), MacroCmd::makeTemplate(), OpalParser::parse(), Line::parse(), OpalElement::parse(), Object::parse(), OpalParser::parseAction(), Macro::parseActuals(), Expressions::parseAnd(), Expressions::parseArrayFactor(), Expressions::parseArrayPrimary(), Expressions::parseArrayTerm(), OpalParser::parseAssign(), Expressions::parseBool(), Expressions::parseBoolArray(), Expressions::parseBracketList(), Expressions::parseColumnGenerator(), OpalParser::parseDefine(), Expressions::parseDelimiter(), OpalParser::parseEnd(), Expressions::parseFactor(), Macro::parseFormals(), Line::parseList(), OpalParser::parseMacro(), SequenceParser::parseMember(), Expressions::parsePlace(), SequenceParser::parsePosition(), Expressions::parsePrimary(), Expressions::parseRange(), Expressions::parseReal(), Expressions::parseRealArray(), Expressions::parseReference(), Expressions::parseRelation(), Expressions::parseRowGenerator(), Object::parseShortcut(), Expressions::parseString(), Expressions::parseStringArray(), Expressions::parseStringValue(), Expressions::parseTableGenerator(), Expressions::parseTerm(), and Expressions::parseTokenListArray().
| bool Statement::delimiter | ( | const char * | s | ) |
Test for delimiter choice.
Definition at line 111 of file Statement.cpp.
Execute.
Implemented in SimpleStatement, CompoundStatement, IfStatement, and WhileStatement.
Referenced by IfStatement::execute(), WhileStatement::execute(), and minimal_runner.MinimalRunner::execute_fork().
| Token & Statement::getCurrent | ( | ) |
Return current token and skip it.
Definition at line 74 of file Statement.cpp.
References curr.
Referenced by MacroCmd::makeTemplate(), OpalParser::parse(), Macro::parseActuals(), Expressions::parseBracketList(), OpalParser::parseMacro(), LineTemplate::parseTemplate(), and Expressions::parseTokenList().
| bool Statement::integer | ( | int & | value | ) |
Return signed integer.
Definition at line 79 of file Statement.cpp.
Referenced by List::list(), and Line::parseList().
| bool Statement::integer | ( | unsigned & | value | ) |
| bool Statement::keyword | ( | const char * | s | ) |
Test for keyword.
Definition at line 121 of file Statement.cpp.
Referenced by MacroCmd::makeTemplate(), SequenceParser::parse(), OpalParser::parse(), Expressions::parseArrayPrimary(), OpalParser::parseAssign(), OpalParser::parseDefine(), Expressions::parsePlace(), SequenceParser::parsePosition(), Expressions::parseRange(), LineTemplate::parseTemplate(), and SequenceTemplate::parseTemplate().
| void Statement::mark | ( | ) |
Mark position in command.
Definition at line 170 of file Statement.cpp.
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 190 of file Statement.cpp.
References Physics::c, curr, and tokens.
Referenced by OpalParser::parse(), and OpalParser::parseEnd().
|
virtual |
Print statement.
Definition at line 204 of file Statement.cpp.
References Physics::c, endl(), and tokens.
Referenced by IfStatement::execute(), WhileStatement::execute(), operator<<(), OpalParser::parse(), OpalParser::parseEnd(), and str().

Print position.
Definition at line 217 of file Statement.cpp.
References buffer_name, curr, endl(), stat_line, and tokens.
Referenced by OpalParser::readStatement().

| bool Statement::real | ( | double & | value | ) |
Return real value.
Definition at line 131 of file Statement.cpp.
Referenced by Expressions::parseArrayPrimary(), and Expressions::parsePrimary().
| void Statement::restore | ( | ) |
Return to marked position.
Definition at line 175 of file Statement.cpp.
Referenced by OpalParser::parse(), OpalParser::parseMacro(), Expressions::parseRelation(), Object::parseShortcut(), and Expressions::parseTokenList().
| void Statement::skip | ( | ) |
| void Statement::start | ( | ) |
Return to start.
Definition at line 180 of file Statement.cpp.
Referenced by IfStatement::execute(), List::list(), LineTemplate::makeInstance(), SequenceParser::parse(), OpalParser::parse(), OpalParser::parseAction(), OpalParser::parseAssign(), OpalParser::parseDefine(), and OpalParser::readStatement().
| bool Statement::str | ( | std::string & | value | ) |
Return string value.
Definition at line 148 of file Statement.cpp.
Referenced by Expressions::parseString(), and Expressions::parseStringValue().
| std::string Statement::str | ( | ) | const |
Definition at line 232 of file Statement.cpp.
References print().

| bool Statement::word | ( | std::string & | value | ) |
Return word value.
Definition at line 159 of file Statement.cpp.
Referenced by boolean(), Expressions::parseRelation(), Object::parseShortcut(), Expressions::parseString(), and Expressions::parseStringValue().
|
protected |
Definition at line 176 of file Statement.h.
Referenced by CompoundStatement::CompoundStatement(), and printWhere().
|
protected |
Definition at line 180 of file Statement.h.
Referenced by atEnd(), boolean(), delimiter(), WhileStatement::execute(), SimpleStatement::execute(), getCurrent(), integer(), keyword(), mark(), position(), printWhere(), real(), restore(), skip(), start(), Statement(), str(), and word().
|
protected |
Definition at line 181 of file Statement.h.
Referenced by WhileStatement::execute(), SimpleStatement::execute(), mark(), and restore().
|
protected |
Definition at line 173 of file Statement.h.
Referenced by CompoundStatement::CompoundStatement(), and printWhere().
|
protected |
Definition at line 179 of file Statement.h.
Referenced by append(), atEnd(), boolean(), delimiter(), WhileStatement::execute(), SimpleStatement::execute(), integer(), keyword(), position(), print(), printWhere(), real(), start(), Statement(), str(), word(), and ~Statement().
1.8.5