OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
SimpleStatement.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: SimpleStatement.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: SimpleStatement
10 // Concrete representation for a standard input language statement.
11 //
12 // ------------------------------------------------------------------------
13 // Class category: Parser
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:32:37 $
17 // $Author: fci $
18 //
19 // ------------------------------------------------------------------------
20 
21 #include "Parser/SimpleStatement.h"
22 #include "Parser/Parser.h"
23 #include "Parser/Token.h"
24 #include "Parser/TokenStream.h"
25 
26 
27 // class SimpleStatement
28 // ------------------------------------------------------------------------
29 
30 SimpleStatement::SimpleStatement(const std::string &name, int line):
31  Statement(name, line)
32 {}
33 
34 
35 SimpleStatement::SimpleStatement(const std::string &name, TokenList &list):
36  Statement(name, list)
37 {}
38 
39 
41 {}
42 
43 
44 void SimpleStatement::execute(const Parser &parser) {
45  curr = keep = tokens.begin();
46  if(curr != tokens.end()) parser.parse(*this);
47 }
TokenList::iterator keep
Definition: Statement.h:180
TokenList tokens
Definition: Statement.h:178
Interface for abstract language parser.
Definition: Parser.h:31
std::list< Token > TokenList
The type of the enclosed token list.
Definition: Statement.h:43
Interface for statements.
Definition: Statement.h:38
virtual void execute(const Parser &)
Execute statement.
TokenList::iterator curr
Definition: Statement.h:179
virtual ~SimpleStatement()
Destructor.
virtual void parse(Statement &stat) const =0
Parse and execute the statement.
const std::string name
SimpleStatement(const std::string &streamName, int streamLine)
Constructor.