#include "naredba.hpp" #include #include void IspisS::izvrsi() const { cout << _s << endl; } Naredba* IspisS::kopija() const { return new IspisS(*this); } void IspisE::izvrsi() const { cout << _i->vrednost() << endl; } IspisE::~IspisE() { delete _i; } IspisE::IspisE(const IspisE& a) { _i = a._i->kopija(); } IspisE& IspisE::operator=(const IspisE& a) { if (this != &a) { delete _i; _i = a._i->kopija(); } return *this; } Naredba* IspisE::kopija() const { return new IspisE(*this); } void Blok::izvrsi() const { for (unsigned i = 0; i < _v.size(); i++) _v[i]->izvrsi(); } Blok::~Blok() { for (unsigned i = 0; i < _v.size(); i++) delete _v[i]; } Blok::Blok(const Blok& b) { for (unsigned i = 0; i < _v.size(); i++) _v.push_back(b._v[i]->kopija()); } Blok& Blok::operator=(const Blok& b) { if (this != &b) { for (unsigned i = 0; i < _v.size(); i++) delete _v[i]; for (unsigned i = 0; i < _v.size(); i++) _v.push_back(b._v[i]->kopija()); } return *this; } Naredba* Blok::kopija() const { return new Blok(*this); } extern map tablica_simbola; void Dodela::izvrsi() const { tablica_simbola[_ime] = _i->vrednost(); } Naredba* Dodela::kopija() const { return new Dodela(*this); } Dodela::~Dodela() { delete _i; } Dodela::Dodela(const Dodela& x) { _ime = x._ime; _i = x._i->kopija(); } Dodela& Dodela::operator=(const Dodela& x) { if (this != &x) { delete _i; _ime = x._ime; _i = x._i->kopija(); } return *this; }