Piethon  1.0
A Python-like interpreter using flex and bison.
symbolTable.cpp
Go to the documentation of this file.
1 #include "exception.h"
2 #include "symbolTable.h"
3 
4 Number SymbolTable::operator[](const string& ident) const {
5  // ensure variable is defined
6  if (symTable.count(ident) == 0) {
7  throw UnboundIdentifier();
8  }
9  // return value
10  return symTable.find(ident)->second;
11 }
12 
13 Number& SymbolTable::operator[](const string& ident) {
14  // return reference to entry in symTable
15  return symTable[ident];
16 }
17 
Number operator[](const string &) const
Definition: symbolTable.cpp:4
Definition: number.h:21