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

#include <statement.h>

Inheritance diagram for IfElse:
Inheritance graph
Collaboration diagram for IfElse:
Collaboration graph

Public Member Functions

 IfElse (Expression *cond, StatementList *tList, StatementList *fList)
 
 IfElse (Expression *cond, StatementList *tList)
 
 ~IfElse ()
 
void eval (SymbolTable &, FunctionTable &) const
 
- Public Member Functions inherited from Statement
virtual ~Statement ()
 
virtual int getLineNumber () const
 

Additional Inherited Members

- Protected Member Functions inherited from Statement
 Statement ()
 
 Statement (int i)
 
- Protected Attributes inherited from Statement
int lineNumber
 

Detailed Description

Definition at line 83 of file statement.h.

Constructor & Destructor Documentation

◆ IfElse() [1/2]

IfElse::IfElse ( Expression cond,
StatementList tList,
StatementList fList 
)
inline

Definition at line 85 of file statement.h.

85 : condition(cond), trueList(tList), falseList(fList) { }

◆ IfElse() [2/2]

IfElse::IfElse ( Expression cond,
StatementList tList 
)
inline

Definition at line 86 of file statement.h.

86 : condition(cond), trueList(tList), falseList(new StatementList()) { }

◆ ~IfElse()

IfElse::~IfElse ( )

Definition at line 50 of file statement.cpp.

50  {
51  delete condition;
52  delete trueList;
53  delete falseList;
54 }

Member Function Documentation

◆ eval()

void IfElse::eval ( SymbolTable st,
FunctionTable ft 
) const
virtual

Implements Statement.

Definition at line 56 of file statement.cpp.

56  {
57  if (condition->eval(st, ft) > 0) {
58  trueList->eval(st, ft);
59  } else {
60  falseList->eval(st, ft);
61  }
62 }
virtual Number eval(const SymbolTable &, const FunctionTable &) const =0
void eval(SymbolTable &, FunctionTable &) const
Definition: statement.cpp:103

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