Piethon  1.0
A Python-like interpreter using flex and bison.
Public Member Functions | List of all members
StatementList Class Reference

#include <statement.h>

Collaboration diagram for StatementList:
Collaboration graph

Public Member Functions

 ~StatementList ()
 
void eval (SymbolTable &, FunctionTable &) const
 
void add (Statement *)
 

Detailed Description

Definition at line 45 of file statement.h.

Constructor & Destructor Documentation

◆ ~StatementList()

StatementList::~StatementList ( )

Definition at line 93 of file statement.cpp.

93  {
94  for (list<Statement*>::const_iterator it = stmtList.begin(); it != stmtList.end(); ++it) {
95  delete *it;
96  }
97 }

Member Function Documentation

◆ add()

void StatementList::add ( Statement stmt)

Definition at line 99 of file statement.cpp.

99  {
100  stmtList.push_back(stmt);
101 }

◆ eval()

void StatementList::eval ( SymbolTable st,
FunctionTable ft 
) const

Definition at line 103 of file statement.cpp.

103  {
104  // eval() each statement in statement list
105  list<Statement*>::const_iterator it;
106  try {
107  for (it = stmtList.begin(); it != stmtList.end(); ++it) {
108  (*it)->eval(st, ft);
109  }
110  } catch (ParseException e) {
111  // if we catch an exception indicating a semantic error, print it and bail out
112  cerr << "error (line " << (*it)->getLineNumber() << "): " << e.what() << endl;
113  exit(2);
114  }
115 }
virtual const char * what() const
Definition: exception.cpp:3

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