Commit 8072a075 authored by zygzagZ's avatar zygzagZ

Convert to tabs

parent 0df5b04c
......@@ -7,29 +7,29 @@
/******************** PIdent ********************/
PIdent::PIdent(String p1, Integer p2)
{
string_ = p1;
integer_ = p2;
string_ = p1;
integer_ = p2;
}
PIdent::PIdent(const PIdent & other)
{
string_ = other.string_;
integer_ = other.integer_;
string_ = other.string_;
integer_ = other.integer_;
}
PIdent &PIdent::operator=(const PIdent & other)
{
PIdent tmp(other);
swap(tmp);
return *this;
PIdent tmp(other);
swap(tmp);
return *this;
}
void PIdent::swap(PIdent & other)
{
std::swap(string_, other.string_);
std::swap(integer_, other.integer_);
std::swap(string_, other.string_);
std::swap(integer_, other.integer_);
}
......@@ -40,12 +40,12 @@ PIdent::~PIdent()
void PIdent::accept(Visitor *v)
{
v->visitPIdent(this);
v->visitPIdent(this);
}
PIdent *PIdent::clone() const
{
return new PIdent(*this);
return new PIdent(*this);
}
......@@ -53,43 +53,43 @@ PIdent *PIdent::clone() const
/******************** Prog ********************/
Prog::Prog(ListTopDef *p1)
{
listtopdef_ = p1;
listtopdef_ = p1;
}
Prog::Prog(const Prog & other)
{
listtopdef_ = other.listtopdef_->clone();
listtopdef_ = other.listtopdef_->clone();
}
Prog &Prog::operator=(const Prog & other)
{
Prog tmp(other);
swap(tmp);
return *this;
Prog tmp(other);
swap(tmp);
return *this;
}
void Prog::swap(Prog & other)
{
std::swap(listtopdef_, other.listtopdef_);
std::swap(listtopdef_, other.listtopdef_);
}
Prog::~Prog()
{
delete(listtopdef_);
delete(listtopdef_);
}
void Prog::accept(Visitor *v)
{
v->visitProg(this);
v->visitProg(this);
}
Prog *Prog::clone() const
{
return new Prog(*this);
return new Prog(*this);
}
......@@ -97,43 +97,43 @@ Prog *Prog::clone() const
/******************** FnDef ********************/
FnDef::FnDef(FunDef *p1)
{
fundef_ = p1;
fundef_ = p1;
}
FnDef::FnDef(const FnDef & other)
{
fundef_ = other.fundef_->clone();
fundef_ = other.fundef_->clone();
}
FnDef &FnDef::operator=(const FnDef & other)
{
FnDef tmp(other);
swap(tmp);
return *this;
FnDef tmp(other);
swap(tmp);
return *this;
}
void FnDef::swap(FnDef & other)
{
std::swap(fundef_, other.fundef_);
std::swap(fundef_, other.fundef_);
}
FnDef::~FnDef()
{
delete(fundef_);
delete(fundef_);
}
void FnDef::accept(Visitor *v)
{
v->visitFnDef(this);
v->visitFnDef(this);
}
FnDef *FnDef::clone() const
{
return new FnDef(*this);
return new FnDef(*this);
}
......@@ -141,43 +141,43 @@ FnDef *FnDef::clone() const
/******************** ClDef ********************/
ClDef::ClDef(ClassDef *p1)
{
classdef_ = p1;
classdef_ = p1;
}
ClDef::ClDef(const ClDef & other)
{
classdef_ = other.classdef_->clone();
classdef_ = other.classdef_->clone();
}
ClDef &ClDef::operator=(const ClDef & other)
{
ClDef tmp(other);
swap(tmp);
return *this;
ClDef tmp(other);
swap(tmp);
return *this;
}
void ClDef::swap(ClDef & other)
{
std::swap(classdef_, other.classdef_);
std::swap(classdef_, other.classdef_);
}
ClDef::~ClDef()
{
delete(classdef_);
delete(classdef_);
}
void ClDef::accept(Visitor *v)
{
v->visitClDef(this);
v->visitClDef(this);
}
ClDef *ClDef::clone() const
{
return new ClDef(*this);
return new ClDef(*this);
}
......@@ -185,55 +185,55 @@ ClDef *ClDef::clone() const
/******************** FuncDef ********************/
FuncDef::FuncDef(Type *p1, PIdent *p2, ListArg *p3, Block *p4)
{
type_ = p1;
pident_ = p2;
listarg_ = p3;
block_ = p4;
type_ = p1;
pident_ = p2;
listarg_ = p3;
block_ = p4;
}
FuncDef::FuncDef(const FuncDef & other)
{
type_ = other.type_->clone();
pident_ = other.pident_->clone();
listarg_ = other.listarg_->clone();
block_ = other.block_->clone();
type_ = other.type_->clone();
pident_ = other.pident_->clone();
listarg_ = other.listarg_->clone();
block_ = other.block_->clone();
}
FuncDef &FuncDef::operator=(const FuncDef & other)
{
FuncDef tmp(other);
swap(tmp);
return *this;
FuncDef tmp(other);
swap(tmp);
return *this;
}
void FuncDef::swap(FuncDef & other)
{
std::swap(type_, other.type_);
std::swap(pident_, other.pident_);
std::swap(listarg_, other.listarg_);
std::swap(block_, other.block_);
std::swap(type_, other.type_);
std::swap(pident_, other.pident_);
std::swap(listarg_, other.listarg_);
std::swap(block_, other.block_);
}
FuncDef::~FuncDef()
{
delete(type_);
delete(pident_);
delete(listarg_);
delete(block_);
delete(type_);
delete(pident_);
delete(listarg_);
delete(block_);
}
void FuncDef::accept(Visitor *v)
{
v->visitFuncDef(this);
v->visitFuncDef(this);
}
FuncDef *FuncDef::clone() const
{
return new FuncDef(*this);
return new FuncDef(*this);
}
......@@ -241,47 +241,47 @@ FuncDef *FuncDef::clone() const
/******************** Ar ********************/
Ar::Ar(Type *p1, PIdent *p2)
{
type_ = p1;
pident_ = p2;
type_ = p1;
pident_ = p2;
}
Ar::Ar(const Ar & other)
{
type_ = other.type_->clone();
pident_ = other.pident_->clone();
type_ = other.type_->clone();
pident_ = other.pident_->clone();
}
Ar &Ar::operator=(const Ar & other)
{
Ar tmp(other);
swap(tmp);
return *this;
Ar tmp(other);
swap(tmp);
return *this;
}
void Ar::swap(Ar & other)
{
std::swap(type_, other.type_);
std::swap(pident_, other.pident_);
std::swap(type_, other.type_);
std::swap(pident_, other.pident_);
}
Ar::~Ar()
{
delete(type_);
delete(pident_);
delete(type_);
delete(pident_);
}
void Ar::accept(Visitor *v)
{
v->visitAr(this);
v->visitAr(this);
}
Ar *Ar::clone() const
{
return new Ar(*this);
return new Ar(*this);
}
......@@ -289,47 +289,47 @@ Ar *Ar::clone() const
/******************** ClassDefN ********************/
ClassDefN::ClassDefN(PIdent *p1, ClassBlock *p2)
{
pident_ = p1;
classblock_ = p2;
pident_ = p1;
classblock_ = p2;
}
ClassDefN::ClassDefN(const ClassDefN & other)
{
pident_ = other.pident_->clone();
classblock_ = other.classblock_->clone();
pident_ = other.pident_->clone();
classblock_ = other.classblock_->clone();
}
ClassDefN &ClassDefN::operator=(const ClassDefN & other)
{
ClassDefN tmp(other);
swap(tmp);
return *this;
ClassDefN tmp(other);
swap(tmp);
return *this;
}
void ClassDefN::swap(ClassDefN & other)
{
std::swap(pident_, other.pident_);
std::swap(classblock_, other.classblock_);
std::swap(pident_, other.pident_);
std::swap(classblock_, other.classblock_);
}
ClassDefN::~ClassDefN()
{
delete(pident_);
delete(classblock_);
delete(pident_);
delete(classblock_);
}
void ClassDefN::accept(Visitor *v)
{
v->visitClassDefN(this);
v->visitClassDefN(this);
}
ClassDefN *ClassDefN::clone() const
{
return new ClassDefN(*this);
return new ClassDefN(*this);
}
......@@ -337,51 +337,51 @@ ClassDefN *ClassDefN::clone() const
/******************** ClassDefE ********************/
ClassDefE::ClassDefE(PIdent *p1, PIdent *p2, ClassBlock *p3)
{
pident_1 = p1;
pident_2 = p2;
classblock_ = p3;
pident_1 = p1;
pident_2 = p2;
classblock_ = p3;
}
ClassDefE::ClassDefE(const ClassDefE & other)
{
pident_1 = other.pident_1->clone();
pident_2 = other.pident_2->clone();
classblock_ = other.classblock_->clone();
pident_1 = other.pident_1->clone();
pident_2 = other.pident_2->clone();
classblock_ = other.classblock_->clone();
}
ClassDefE &ClassDefE::operator=(const ClassDefE & other)
{
ClassDefE tmp(other);
swap(tmp);
return *this;
ClassDefE tmp(other);
swap(tmp);
return *this;
}
void ClassDefE::swap(ClassDefE & other)
{
std::swap(pident_1, other.pident_1);
std::swap(pident_2, other.pident_2);
std::swap(classblock_, other.classblock_);
std::swap(pident_1, other.pident_1);
std::swap(pident_2, other.pident_2);
std::swap(classblock_, other.classblock_);
}
ClassDefE::~ClassDefE()
{
delete(pident_1);
delete(pident_2);
delete(classblock_);
delete(pident_1);
delete(pident_2);
delete(classblock_);
}
void ClassDefE::accept(Visitor *v)
{
v->visitClassDefE(this);
v->visitClassDefE(this);
}
ClassDefE *ClassDefE::clone() const
{
return new ClassDefE(*this);
return new ClassDefE(*this);
}
......@@ -389,43 +389,43 @@ ClassDefE *ClassDefE::clone() const
/******************** ClassBl ********************/
ClassBl::ClassBl(ListClassBlockDef *p1)
{
listclassblockdef_ = p1;
listclassblockdef_ = p1;
}
ClassBl::ClassBl(const ClassBl & other)
{
listclassblockdef_ = other.listclassblockdef_->clone();
listclassblockdef_ = other.listclassblockdef_->clone();
}
ClassBl &ClassBl::operator=(const ClassBl & other)
{
ClassBl tmp(other);
swap(tmp);
return *this;
ClassBl tmp(other);
swap(tmp);
return *this;
}
void ClassBl::swap(ClassBl & other)
{
std::swap(listclassblockdef_, other.listclassblockdef_);
std::swap(listclassblockdef_, other.listclassblockdef_);
}
ClassBl::~ClassBl()
{
delete(listclassblockdef_);
delete(listclassblockdef_);
}
void ClassBl::accept(Visitor *v)
{
v->visitClassBl(this);
v->visitClassBl(this);
}
ClassBl *ClassBl::clone() const
{
return new ClassBl(*this);
return new ClassBl(*this);
}
......@@ -433,43 +433,43 @@ ClassBl *ClassBl::clone() const
/******************** ClassMthd ********************/
ClassMthd::ClassMthd(FunDef *p1)
{
fundef_ = p1;
fundef_ = p1;
}
ClassMthd::ClassMthd(const ClassMthd & other)
{
fundef_ = other.fundef_->clone();
fundef_ = other.fundef_->clone();
}
ClassMthd &ClassMthd::operator=(const ClassMthd & other)
{
ClassMthd tmp(other);
swap(tmp);
return *this;
ClassMthd tmp(other);
swap(tmp);
return *this;
}
void ClassMthd::swap(ClassMthd & other)
{
std::swap(fundef_, other.fundef_);
std::swap(fundef_, other.fundef_);
}
ClassMthd::~ClassMthd()
{
delete(fundef_);
delete(fundef_);
}
void ClassMthd::accept(Visitor *v)
{
v->visitClassMthd(this);
v->visitClassMthd(this);
}
ClassMthd *ClassMthd::clone() const
{
return new ClassMthd(*this);
return new ClassMthd(*this);
}
......@@ -477,47 +477,47 @@ ClassMthd *ClassMthd::clone() const
/******************** ClassFld ********************/
ClassFld::ClassFld(Type *p1, ListItem *p2)
{
type_ = p1;
listitem_ = p2;
type_ = p1;
listitem_ = p2;
}
ClassFld::ClassFld(const ClassFld & other)
{
type_ = other.type_->clone();
listitem_ = other.listitem_->clone();
type_ = other.type_->clone();
listitem_ = other.listitem_->clone();
}
ClassFld &ClassFld::operator=(const ClassFld & other)
{
ClassFld tmp(other);
swap(tmp);
return *this;
ClassFld tmp(other);
swap(tmp);
return *this;
}
void ClassFld::swap(ClassFld & other)
{
std::swap(type_, other.type_);
std::swap(listitem_, other.listitem_);
std::swap(type_, other.type_);
std::swap(listitem_, other.listitem_);
}
ClassFld::~ClassFld()
{
delete(type_);
delete(listitem_);
delete(type_);
delete(listitem_);
}
void ClassFld::accept(Visitor *v)
{
v->visitClassFld(this);
v->visitClassFld(this);
}
ClassFld *ClassFld::clone() const
{
return new ClassFld(*this);
return new ClassFld(*this);
}
......@@ -525,43 +525,43 @@ ClassFld *ClassFld::clone() const
/******************** Blk ********************/
Blk::Blk(ListStmt *p1)
{
liststmt_ = p1;
liststmt_ = p1;
}
Blk::Blk(const Blk & other)
{
liststmt_ = other.liststmt_->clone();
liststmt_ = other.liststmt_->clone();
}
Blk &Blk::operator=(const Blk & other)
{
Blk tmp(other);
swap(tmp);
return *this;
Blk tmp(other);
swap(tmp);
return *this;
}
void Blk::swap(Blk & other)
{
std::swap(liststmt_, other.liststmt_);
std::swap(liststmt_, other.liststmt_);
}
Blk::~Blk()
{
delete(liststmt_);
delete(liststmt_);
}
void Blk::accept(Visitor *v)
{
v->visitBlk(this);
v->visitBlk(this);
}
Blk *Blk::clone() const
{
return new Blk(*this);
return new Blk(*this);
}
......@@ -579,9 +579,9 @@ Empty::Empty(const Empty & other)
Empty &Empty::operator=(const Empty & other)
{
Empty tmp(other);
swap(tmp);
return *this;
Empty tmp(other);
swap(tmp);
return *this;
}
void Empty::swap(Empty & other)
......@@ -596,12 +596,12 @@ Empty::~Empty()
void Empty::accept(Visitor *v)
{
v->visitEmpty(this);
v->visitEmpty(this);
}
Empty *Empty::clone() const
{
return new Empty(*this);
return new Empty(*this);
}
......@@ -609,43 +609,43 @@ Empty *Empty::clone() const
/******************** BStmt ********************/
BStmt::BStmt(Block *p1)
{
block_ = p1;
block_ = p1;
}
BStmt::BStmt(const BStmt & other)
{
block_ = other.block_->clone();
block_ = other.block_->clone();
}
BStmt &BStmt::operator=(const BStmt & other)
{
BStmt tmp(other);
swap(tmp);
return *this;
BStmt tmp(other);
swap(tmp);
return *this;
}
void BStmt::swap(BStmt & other)
{
std::swap(block_, other.block_);
std::swap(block_, other.block_);
}
BStmt::~BStmt()
{
delete(block_);
delete(block_);
}
void BStmt::accept(Visitor *v)
{
v->visitBStmt(this);
v->visitBStmt(this);
}
BStmt *BStmt::clone() const
{
return new BStmt(*this);
return new BStmt(*this);
}
......@@ -653,47 +653,47 @@ BStmt *BStmt::clone() const
/******************** Decl ********************/
Decl::Decl(Type *p1, ListItem *p2)
{
type_ = p1;
listitem_ = p2;
type_ = p1;
listitem_ = p2;
}
Decl::Decl(const Decl & other)
{
type_ = other.type_->clone();
listitem_ = other.listitem_->clone();
type_ = other.type_->clone();
listitem_ = other.listitem_->clone();
}
Decl &Decl::operator=(const Decl & other)
{
Decl tmp(other);
swap(tmp);
return *this;
Decl tmp(other);
swap(tmp);
return *this;
}
void Decl::swap(Decl & other)
{
std::swap(type_, other.type_);
std::swap(listitem_, other.listitem_);
std::swap(type_, other.type_);
std::swap(listitem_, other.listitem_);
}
Decl::~Decl()
{
delete(type_);
delete(listitem_);
delete(type_);
delete(listitem_);
}
void Decl::accept(Visitor *v)
{
v->visitDecl(this);
v->visitDecl(this);
}
Decl *Decl::clone() const
{
return new Decl(*this);
return new Decl(*this);
}
......@@ -701,47 +701,47 @@ Decl *Decl::clone() const
/******************** Ass ********************/
Ass::Ass(Expr *p1, Expr *p2)
{
expr_1 = p1;
expr_2 = p2;
expr_1 = p1;
expr_2 = p2;
}
Ass::Ass(const Ass & other)
{
expr_1 = other.expr_1->clone();
expr_2 = other.expr_2->clone();
expr_1 = other.expr_1->clone();
expr_2 = other.expr_2->clone();
}
Ass &Ass::operator=(const Ass & other)
{
Ass tmp(other);
swap(tmp);
return *this;
Ass tmp(other);
swap(tmp);
return *this;
}
void Ass::swap(Ass & other)
{
std::swap(expr_1, other.expr_1);
std::swap(expr_2, other.expr_2);
std::swap(expr_1, other.expr_1);
std::swap(expr_2, other.expr_2);
}
Ass::~Ass()
{
delete(expr_1);
delete(expr_2);
delete(expr_1);
delete(expr_2);
}
void Ass::accept(Visitor *v)
{
v->visitAss(this);
v->visitAss(this);
}
Ass *Ass::clone() const
{
return new Ass(*this);
return new Ass(*this);
}
......@@ -749,51 +749,51 @@ Ass *Ass::clone() const
/******************** TableAss ********************/
TableAss::TableAss(PIdent *p1, Expr *p2, Expr *p3)
{
pident_ = p1;
expr_1 = p2;
expr_2 = p3;
pident_ = p1;
expr_1 = p2;
expr_2 = p3;
}
TableAss::TableAss(const TableAss & other)
{
pident_ = other.pident_->clone();
expr_1 = other.expr_1->clone();
expr_2 = other.expr_2->clone();
pident_ = other.pident_->clone();
expr_1 = other.expr_1->clone();
expr_2 = other.expr_2->clone();
}
TableAss &TableAss::operator=(const TableAss & other)
{
TableAss tmp(other);
swap(tmp);
return *this;
TableAss tmp(other);
swap(tmp);
return *this;
}
void TableAss::swap(TableAss & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_1, other.expr_1);
std::swap(expr_2, other.expr_2);
std::swap(pident_, other.pident_);
std::swap(expr_1, other.expr_1);
std::swap(expr_2, other.expr_2);
}
TableAss::~TableAss()
{
delete(pident_);
delete(expr_1);
delete(expr_2);
delete(pident_);
delete(expr_1);
delete(expr_2);
}
void TableAss::accept(Visitor *v)
{
v->visitTableAss(this);
v->visitTableAss(this);
}
TableAss *TableAss::clone() const
{
return new TableAss(*this);
return new TableAss(*this);
}
......@@ -801,47 +801,47 @@ TableAss *TableAss::clone() const
/******************** TableIncr ********************/
TableIncr::TableIncr(PIdent *p1, Expr *p2)
{
pident_ = p1;
expr_ = p2;
pident_ = p1;
expr_ = p2;
}
TableIncr::TableIncr(const TableIncr & other)
{
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
}
TableIncr &TableIncr::operator=(const TableIncr & other)
{
TableIncr tmp(other);
swap(tmp);
return *this;
TableIncr tmp(other);
swap(tmp);
return *this;
}
void TableIncr::swap(TableIncr & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
}
TableIncr::~TableIncr()
{
delete(pident_);
delete(expr_);
delete(pident_);
delete(expr_);
}
void TableIncr::accept(Visitor *v)
{
v->visitTableIncr(this);
v->visitTableIncr(this);
}
TableIncr *TableIncr::clone() const
{
return new TableIncr(*this);
return new TableIncr(*this);
}
......@@ -849,47 +849,47 @@ TableIncr *TableIncr::clone() const
/******************** TableDecr ********************/
TableDecr::TableDecr(PIdent *p1, Expr *p2)
{
pident_ = p1;
expr_ = p2;
pident_ = p1;
expr_ = p2;
}
TableDecr::TableDecr(const TableDecr & other)
{
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
}
TableDecr &TableDecr::operator=(const TableDecr & other)
{
TableDecr tmp(other);
swap(tmp);
return *this;
TableDecr tmp(other);
swap(tmp);
return *this;
}
void TableDecr::swap(TableDecr & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
}
TableDecr::~TableDecr()
{
delete(pident_);
delete(expr_);
delete(pident_);
delete(expr_);
}
void TableDecr::accept(Visitor *v)
{
v->visitTableDecr(this);
v->visitTableDecr(this);
}
TableDecr *TableDecr::clone() const
{
return new TableDecr(*this);
return new TableDecr(*this);
}
......@@ -897,43 +897,43 @@ TableDecr *TableDecr::clone() const
/******************** Incr ********************/
Incr::Incr(PIdent *p1)
{
pident_ = p1;
pident_ = p1;
}
Incr::Incr(const Incr & other)
{
pident_ = other.pident_->clone();
pident_ = other.pident_->clone();
}
Incr &Incr::operator=(const Incr & other)
{
Incr tmp(other);
swap(tmp);
return *this;
Incr tmp(other);
swap(tmp);
return *this;
}
void Incr::swap(Incr & other)
{
std::swap(pident_, other.pident_);
std::swap(pident_, other.pident_);
}
Incr::~Incr()
{
delete(pident_);
delete(pident_);
}
void Incr::accept(Visitor *v)
{
v->visitIncr(this);
v->visitIncr(this);
}
Incr *Incr::clone() const
{
return new Incr(*this);
return new Incr(*this);
}
......@@ -941,43 +941,43 @@ Incr *Incr::clone() const
/******************** Decr ********************/
Decr::Decr(PIdent *p1)
{
pident_ = p1;
pident_ = p1;
}
Decr::Decr(const Decr & other)
{
pident_ = other.pident_->clone();
pident_ = other.pident_->clone();
}
Decr &Decr::operator=(const Decr & other)
{
Decr tmp(other);
swap(tmp);
return *this;
Decr tmp(other);
swap(tmp);
return *this;
}
void Decr::swap(Decr & other)
{
std::swap(pident_, other.pident_);
std::swap(pident_, other.pident_);
}
Decr::~Decr()
{
delete(pident_);
delete(pident_);
}
void Decr::accept(Visitor *v)
{
v->visitDecr(this);
v->visitDecr(this);
}
Decr *Decr::clone() const
{
return new Decr(*this);
return new Decr(*this);
}
......@@ -985,43 +985,43 @@ Decr *Decr::clone() const
/******************** Ret ********************/
Ret::Ret(Expr *p1)
{
expr_ = p1;
expr_ = p1;
}
Ret::Ret(const Ret & other)
{
expr_ = other.expr_->clone();
expr_ = other.expr_->clone();
}
Ret &Ret::operator=(const Ret & other)
{
Ret tmp(other);
swap(tmp);
return *this;
Ret tmp(other);
swap(tmp);
return *this;
}
void Ret::swap(Ret & other)
{
std::swap(expr_, other.expr_);
std::swap(expr_, other.expr_);
}
Ret::~Ret()
{
delete(expr_);
delete(expr_);
}
void Ret::accept(Visitor *v)
{
v->visitRet(this);
v->visitRet(this);
}
Ret *Ret::clone() const
{
return new Ret(*this);
return new Ret(*this);
}
......@@ -1039,9 +1039,9 @@ VRet::VRet(const VRet & other)
VRet &VRet::operator=(const VRet & other)
{
VRet tmp(other);
swap(tmp);
return *this;
VRet tmp(other);
swap(tmp);
return *this;
}
void VRet::swap(VRet & other)
......@@ -1056,12 +1056,12 @@ VRet::~VRet()
void VRet::accept(Visitor *v)
{
v->visitVRet(this);
v->visitVRet(this);
}
VRet *VRet::clone() const
{
return new VRet(*this);
return new VRet(*this);
}
......@@ -1069,47 +1069,47 @@ VRet *VRet::clone() const
/******************** Cond ********************/
Cond::Cond(Expr *p1, Stmt *p2)
{
expr_ = p1;
stmt_ = p2;
expr_ = p1;
stmt_ = p2;
}
Cond::Cond(const Cond & other)
{
expr_ = other.expr_->clone();
stmt_ = other.stmt_->clone();
expr_ = other.expr_->clone();
stmt_ = other.stmt_->clone();
}
Cond &Cond::operator=(const Cond & other)
{
Cond tmp(other);
swap(tmp);
return *this;
Cond tmp(other);
swap(tmp);
return *this;
}
void Cond::swap(Cond & other)
{
std::swap(expr_, other.expr_);
std::swap(stmt_, other.stmt_);
std::swap(expr_, other.expr_);
std::swap(stmt_, other.stmt_);
}
Cond::~Cond()
{
delete(expr_);
delete(stmt_);
delete(expr_);
delete(stmt_);
}
void Cond::accept(Visitor *v)
{
v->visitCond(this);
v->visitCond(this);
}
Cond *Cond::clone() const
{
return new Cond(*this);
return new Cond(*this);
}
......@@ -1117,51 +1117,51 @@ Cond *Cond::clone() const
/******************** CondElse ********************/
CondElse::CondElse(Expr *p1, Stmt *p2, Stmt *p3)
{
expr_ = p1;
stmt_1 = p2;
stmt_2 = p3;
expr_ = p1;
stmt_1 = p2;
stmt_2 = p3;
}
CondElse::CondElse(const CondElse & other)
{
expr_ = other.expr_->clone();
stmt_1 = other.stmt_1->clone();
stmt_2 = other.stmt_2->clone();
expr_ = other.expr_->clone();
stmt_1 = other.stmt_1->clone();
stmt_2 = other.stmt_2->clone();
}
CondElse &CondElse::operator=(const CondElse & other)
{
CondElse tmp(other);
swap(tmp);
return *this;
CondElse tmp(other);
swap(tmp);
return *this;
}
void CondElse::swap(CondElse & other)
{
std::swap(expr_, other.expr_);
std::swap(stmt_1, other.stmt_1);
std::swap(stmt_2, other.stmt_2);
std::swap(expr_, other.expr_);
std::swap(stmt_1, other.stmt_1);
std::swap(stmt_2, other.stmt_2);
}
CondElse::~CondElse()
{
delete(expr_);
delete(stmt_1);
delete(stmt_2);
delete(expr_);
delete(stmt_1);
delete(stmt_2);
}
void CondElse::accept(Visitor *v)
{
v->visitCondElse(this);
v->visitCondElse(this);
}
CondElse *CondElse::clone() const
{
return new CondElse(*this);
return new CondElse(*this);
}
......@@ -1169,47 +1169,47 @@ CondElse *CondElse::clone() const
/******************** While ********************/
While::While(Expr *p1, Stmt *p2)
{
expr_ = p1;
stmt_ = p2;
expr_ = p1;
stmt_ = p2;
}
While::While(const While & other)
{
expr_ = other.expr_->clone();
stmt_ = other.stmt_->clone();
expr_ = other.expr_->clone();
stmt_ = other.stmt_->clone();
}
While &While::operator=(const While & other)
{
While tmp(other);
swap(tmp);
return *this;
While tmp(other);
swap(tmp);
return *this;
}
void While::swap(While & other)
{
std::swap(expr_, other.expr_);
std::swap(stmt_, other.stmt_);
std::swap(expr_, other.expr_);
std::swap(stmt_, other.stmt_);
}
While::~While()
{
delete(expr_);
delete(stmt_);
delete(expr_);
delete(stmt_);
}
void While::accept(Visitor *v)
{
v->visitWhile(this);
v->visitWhile(this);
}
While *While::clone() const
{
return new While(*this);
return new While(*this);
}
......@@ -1217,43 +1217,43 @@ While *While::clone() const
/******************** SExp ********************/
SExp::SExp(Expr *p1)
{
expr_ = p1;
expr_ = p1;
}
SExp::SExp(const SExp & other)
{
expr_ = other.expr_->clone();
expr_ = other.expr_->clone();
}
SExp &SExp::operator=(const SExp & other)
{
SExp tmp(other);
swap(tmp);
return *this;
SExp tmp(other);
swap(tmp);
return *this;
}
void SExp::swap(SExp & other)
{
std::swap(expr_, other.expr_);
std::swap(expr_, other.expr_);
}
SExp::~SExp()
{
delete(expr_);
delete(expr_);
}
void SExp::accept(Visitor *v)
{
v->visitSExp(this);
v->visitSExp(this);
}
SExp *SExp::clone() const
{
return new SExp(*this);
return new SExp(*this);
}
......@@ -1261,55 +1261,55 @@ SExp *SExp::clone() const
/******************** ForEach ********************/
ForEach::ForEach(Type *p1, PIdent *p2, Expr *p3, Stmt *p4)
{
type_ = p1;
pident_ = p2;
expr_ = p3;
stmt_ = p4;
type_ = p1;
pident_ = p2;
expr_ = p3;
stmt_ = p4;
}
ForEach::ForEach(const ForEach & other)
{
type_ = other.type_->clone();
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
stmt_ = other.stmt_->clone();
type_ = other.type_->clone();
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
stmt_ = other.stmt_->clone();
}
ForEach &ForEach::operator=(const ForEach & other)
{
ForEach tmp(other);
swap(tmp);
return *this;
ForEach tmp(other);
swap(tmp);
return *this;
}
void ForEach::swap(ForEach & other)
{
std::swap(type_, other.type_);
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
std::swap(stmt_, other.stmt_);
std::swap(type_, other.type_);
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
std::swap(stmt_, other.stmt_);
}
ForEach::~ForEach()
{
delete(type_);
delete(pident_);
delete(expr_);
delete(stmt_);
delete(type_);
delete(pident_);
delete(expr_);
delete(stmt_);
}
void ForEach::accept(Visitor *v)
{
v->visitForEach(this);
v->visitForEach(this);
}
ForEach *ForEach::clone() const
{
return new ForEach(*this);
return new ForEach(*this);
}
......@@ -1317,43 +1317,43 @@ ForEach *ForEach::clone() const
/******************** NoInit ********************/
NoInit::NoInit(PIdent *p1)
{
pident_ = p1;
pident_ = p1;
}
NoInit::NoInit(const NoInit & other)
{
pident_ = other.pident_->clone();
pident_ = other.pident_->clone();
}
NoInit &NoInit::operator=(const NoInit & other)
{
NoInit tmp(other);
swap(tmp);
return *this;
NoInit tmp(other);
swap(tmp);
return *this;
}
void NoInit::swap(NoInit & other)
{
std::swap(pident_, other.pident_);
std::swap(pident_, other.pident_);
}
NoInit::~NoInit()
{
delete(pident_);
delete(pident_);
}
void NoInit::accept(Visitor *v)
{
v->visitNoInit(this);
v->visitNoInit(this);
}
NoInit *NoInit::clone() const
{
return new NoInit(*this);
return new NoInit(*this);
}
......@@ -1361,47 +1361,47 @@ NoInit *NoInit::clone() const
/******************** Init ********************/
Init::Init(PIdent *p1, Expr *p2)
{
pident_ = p1;
expr_ = p2;
pident_ = p1;
expr_ = p2;
}
Init::Init(const Init & other)
{
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
}
Init &Init::operator=(const Init & other)
{
Init tmp(other);
swap(tmp);
return *this;
Init tmp(other);
swap(tmp);
return *this;
}
void Init::swap(Init & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
}
Init::~Init()
{
delete(pident_);
delete(expr_);
delete(pident_);
delete(expr_);
}
void Init::accept(Visitor *v)
{
v->visitInit(this);
v->visitInit(this);
}
Init *Init::clone() const
{
return new Init(*this);
return new Init(*this);
}
......@@ -1419,9 +1419,9 @@ Int::Int(const Int & other)
Int &Int::operator=(const Int & other)
{
Int tmp(other);
swap(tmp);
return *this;
Int tmp(other);
swap(tmp);
return *this;
}
void Int::swap(Int & other)
......@@ -1436,12 +1436,12 @@ Int::~Int()
void Int::accept(Visitor *v)
{
v->visitInt(this);
v->visitInt(this);
}
Int *Int::clone() const
{
return new Int(*this);
return new Int(*this);
}
......@@ -1459,9 +1459,9 @@ Str::Str(const Str & other)
Str &Str::operator=(const Str & other)
{
Str tmp(other);
swap(tmp);
return *this;
Str tmp(other);
swap(tmp);
return *this;
}
void Str::swap(Str & other)
......@@ -1476,12 +1476,12 @@ Str::~Str()
void Str::accept(Visitor *v)
{
v->visitStr(this);
v->visitStr(this);
}
Str *Str::clone() const
{
return new Str(*this);
return new Str(*this);
}
......@@ -1499,9 +1499,9 @@ Bool::Bool(const Bool & other)
Bool &Bool::operator=(const Bool & other)
{
Bool tmp(other);
swap(tmp);
return *this;
Bool tmp(other);
swap(tmp);
return *this;
}
void Bool::swap(Bool & other)
......@@ -1516,12 +1516,12 @@ Bool::~Bool()
void Bool::accept(Visitor *v)
{
v->visitBool(this);
v->visitBool(this);
}
Bool *Bool::clone() const
{
return new Bool(*this);
return new Bool(*this);
}
......@@ -1539,9 +1539,9 @@ Void::Void(const Void & other)
Void &Void::operator=(const Void & other)
{
Void tmp(other);
swap(tmp);
return *this;
Void tmp(other);
swap(tmp);
return *this;
}
void Void::swap(Void & other)
......@@ -1556,12 +1556,12 @@ Void::~Void()
void Void::accept(Visitor *v)
{
v->visitVoid(this);
v->visitVoid(this);
}
Void *Void::clone() const
{
return new Void(*this);
return new Void(*this);
}
......@@ -1569,43 +1569,43 @@ Void *Void::clone() const
/******************** Array ********************/
Array::Array(Type *p1)
{
type_ = p1;
type_ = p1;
}
Array::Array(const Array & other)
{
type_ = other.type_->clone();
type_ = other.type_->clone();
}
Array &Array::operator=(const Array & other)
{
Array tmp(other);
swap(tmp);
return *this;
Array tmp(other);
swap(tmp);
return *this;
}
void Array::swap(Array & other)
{
std::swap(type_, other.type_);
std::swap(type_, other.type_);
}
Array::~Array()
{
delete(type_);
delete(type_);
}
void Array::accept(Visitor *v)
{
v->visitArray(this);
v->visitArray(this);
}
Array *Array::clone() const
{
return new Array(*this);
return new Array(*this);
}
......@@ -1613,43 +1613,43 @@ Array *Array::clone() const
/******************** ClassT ********************/
ClassT::ClassT(PIdent *p1)
{
pident_ = p1;
pident_ = p1;
}
ClassT::ClassT(const ClassT & other)
{
pident_ = other.pident_->clone();
pident_ = other.pident_->clone();
}
ClassT &ClassT::operator=(const ClassT & other)
{
ClassT tmp(other);
swap(tmp);
return *this;
ClassT tmp(other);
swap(tmp);
return *this;
}
void ClassT::swap(ClassT & other)
{
std::swap(pident_, other.pident_);
std::swap(pident_, other.pident_);
}
ClassT::~ClassT()
{
delete(pident_);
delete(pident_);
}
void ClassT::accept(Visitor *v)
{
v->visitClassT(this);
v->visitClassT(this);
}
ClassT *ClassT::clone() const
{
return new ClassT(*this);
return new ClassT(*this);
}
......@@ -1657,47 +1657,47 @@ ClassT *ClassT::clone() const
/******************** Fun ********************/
Fun::Fun(Type *p1, ListType *p2)
{
type_ = p1;
listtype_ = p2;
type_ = p1;
listtype_ = p2;
}
Fun::Fun(const Fun & other)
{
type_ = other.type_->clone();
listtype_ = other.listtype_->clone();
type_ = other.type_->clone();
listtype_ = other.listtype_->clone();
}
Fun &Fun::operator=(const Fun & other)
{
Fun tmp(other);
swap(tmp);
return *this;
Fun tmp(other);
swap(tmp);
return *this;
}
void Fun::swap(Fun & other)
{
std::swap(type_, other.type_);
std::swap(listtype_, other.listtype_);
std::swap(type_, other.type_);
std::swap(listtype_, other.listtype_);
}
Fun::~Fun()
{
delete(type_);
delete(listtype_);
delete(type_);
delete(listtype_);
}
void Fun::accept(Visitor *v)
{
v->visitFun(this);
v->visitFun(this);
}
Fun *Fun::clone() const
{
return new Fun(*this);
return new Fun(*this);
}
......@@ -1705,43 +1705,43 @@ Fun *Fun::clone() const
/******************** EVar ********************/
EVar::EVar(PIdent *p1)
{
pident_ = p1;
pident_ = p1;
}
EVar::EVar(const EVar & other)
{
pident_ = other.pident_->clone();
pident_ = other.pident_->clone();
}
EVar &EVar::operator=(const EVar & other)
{
EVar tmp(other);
swap(tmp);
return *this;
EVar tmp(other);
swap(tmp);
return *this;
}
void EVar::swap(EVar & other)
{
std::swap(pident_, other.pident_);
std::swap(pident_, other.pident_);
}
EVar::~EVar()
{
delete(pident_);
delete(pident_);
}
void EVar::accept(Visitor *v)
{
v->visitEVar(this);
v->visitEVar(this);
}
EVar *EVar::clone() const
{
return new EVar(*this);
return new EVar(*this);
}
......@@ -1749,26 +1749,26 @@ EVar *EVar::clone() const
/******************** ELitInt ********************/
ELitInt::ELitInt(Integer p1)
{
integer_ = p1;
integer_ = p1;
}
ELitInt::ELitInt(const ELitInt & other)
{
integer_ = other.integer_;
integer_ = other.integer_;
}
ELitInt &ELitInt::operator=(const ELitInt & other)
{
ELitInt tmp(other);
swap(tmp);
return *this;
ELitInt tmp(other);
swap(tmp);
return *this;
}
void ELitInt::swap(ELitInt & other)
{
std::swap(integer_, other.integer_);
std::swap(integer_, other.integer_);
}
......@@ -1779,12 +1779,12 @@ ELitInt::~ELitInt()
void ELitInt::accept(Visitor *v)
{
v->visitELitInt(this);
v->visitELitInt(this);
}
ELitInt *ELitInt::clone() const
{
return new ELitInt(*this);
return new ELitInt(*this);
}
......@@ -1802,9 +1802,9 @@ ELitTrue::ELitTrue(const ELitTrue & other)
ELitTrue &ELitTrue::operator=(const ELitTrue & other)
{
ELitTrue tmp(other);
swap(tmp);
return *this;
ELitTrue tmp(other);
swap(tmp);
return *this;
}
void ELitTrue::swap(ELitTrue & other)
......@@ -1819,12 +1819,12 @@ ELitTrue::~ELitTrue()
void ELitTrue::accept(Visitor *v)
{
v->visitELitTrue(this);
v->visitELitTrue(this);
}
ELitTrue *ELitTrue::clone() const
{
return new ELitTrue(*this);
return new ELitTrue(*this);
}
......@@ -1842,9 +1842,9 @@ ELitFalse::ELitFalse(const ELitFalse & other)
ELitFalse &ELitFalse::operator=(const ELitFalse & other)
{
ELitFalse tmp(other);
swap(tmp);
return *this;
ELitFalse tmp(other);
swap(tmp);
return *this;
}
void ELitFalse::swap(ELitFalse & other)
......@@ -1859,12 +1859,12 @@ ELitFalse::~ELitFalse()
void ELitFalse::accept(Visitor *v)
{
v->visitELitFalse(this);
v->visitELitFalse(this);
}
ELitFalse *ELitFalse::clone() const
{
return new ELitFalse(*this);
return new ELitFalse(*this);
}
......@@ -1872,47 +1872,47 @@ ELitFalse *ELitFalse::clone() const
/******************** EApp ********************/
EApp::EApp(PIdent *p1, ListExpr *p2)
{
pident_ = p1;
listexpr_ = p2;
pident_ = p1;
listexpr_ = p2;
}
EApp::EApp(const EApp & other)
{
pident_ = other.pident_->clone();
listexpr_ = other.listexpr_->clone();
pident_ = other.pident_->clone();
listexpr_ = other.listexpr_->clone();
}
EApp &EApp::operator=(const EApp & other)
{
EApp tmp(other);
swap(tmp);
return *this;
EApp tmp(other);
swap(tmp);
return *this;
}
void EApp::swap(EApp & other)
{
std::swap(pident_, other.pident_);
std::swap(listexpr_, other.listexpr_);
std::swap(pident_, other.pident_);
std::swap(listexpr_, other.listexpr_);
}
EApp::~EApp()
{
delete(pident_);
delete(listexpr_);
delete(pident_);
delete(listexpr_);
}
void EApp::accept(Visitor *v)
{
v->visitEApp(this);
v->visitEApp(this);
}
EApp *EApp::clone() const
{
return new EApp(*this);
return new EApp(*this);
}
......@@ -1920,26 +1920,26 @@ EApp *EApp::clone() const
/******************** EString ********************/
EString::EString(String p1)
{
string_ = p1;
string_ = p1;
}
EString::EString(const EString & other)
{
string_ = other.string_;
string_ = other.string_;
}
EString &EString::operator=(const EString & other)
{
EString tmp(other);
swap(tmp);
return *this;
EString tmp(other);
swap(tmp);
return *this;
}
void EString::swap(EString & other)
{
std::swap(string_, other.string_);
std::swap(string_, other.string_);
}
......@@ -1950,12 +1950,12 @@ EString::~EString()
void EString::accept(Visitor *v)
{
v->visitEString(this);
v->visitEString(this);
}
EString *EString::clone() const
{
return new EString(*this);
return new EString(*this);
}
......@@ -1963,47 +1963,47 @@ EString *EString::clone() const
/******************** ENewArray ********************/
ENewArray::ENewArray(Type *p1, Expr *p2)
{
type_ = p1;
expr_ = p2;
type_ = p1;
expr_ = p2;
}
ENewArray::ENewArray(const ENewArray & other)
{
type_ = other.type_->clone();
expr_ = other.expr_->clone();
type_ = other.type_->clone();
expr_ = other.expr_->clone();
}
ENewArray &ENewArray::operator=(const ENewArray & other)
{
ENewArray tmp(other);
swap(tmp);
return *this;
ENewArray tmp(other);
swap(tmp);
return *this;
}
void ENewArray::swap(ENewArray & other)
{
std::swap(type_, other.type_);
std::swap(expr_, other.expr_);
std::swap(type_, other.type_);
std::swap(expr_, other.expr_);
}
ENewArray::~ENewArray()
{
delete(type_);
delete(expr_);
delete(type_);
delete(expr_);
}
void ENewArray::accept(Visitor *v)
{
v->visitENewArray(this);
v->visitENewArray(this);
}
ENewArray *ENewArray::clone() const
{
return new ENewArray(*this);
return new ENewArray(*this);
}
......@@ -2011,43 +2011,43 @@ ENewArray *ENewArray::clone() const
/******************** ENewClass ********************/
ENewClass::ENewClass(PIdent *p1)
{
pident_ = p1;
pident_ = p1;
}
ENewClass::ENewClass(const ENewClass & other)
{
pident_ = other.pident_->clone();
pident_ = other.pident_->clone();
}
ENewClass &ENewClass::operator=(const ENewClass & other)
{
ENewClass tmp(other);
swap(tmp);
return *this;
ENewClass tmp(other);
swap(tmp);
return *this;
}
void ENewClass::swap(ENewClass & other)
{
std::swap(pident_, other.pident_);
std::swap(pident_, other.pident_);
}
ENewClass::~ENewClass()
{
delete(pident_);
delete(pident_);
}
void ENewClass::accept(Visitor *v)
{
v->visitENewClass(this);
v->visitENewClass(this);
}
ENewClass *ENewClass::clone() const
{
return new ENewClass(*this);
return new ENewClass(*this);
}
......@@ -2055,47 +2055,47 @@ ENewClass *ENewClass::clone() const
/******************** EClsMmbr ********************/
EClsMmbr::EClsMmbr(Expr *p1, PIdent *p2)
{
expr_ = p1;
pident_ = p2;
expr_ = p1;
pident_ = p2;
}
EClsMmbr::EClsMmbr(const EClsMmbr & other)
{
expr_ = other.expr_->clone();
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
pident_ = other.pident_->clone();
}
EClsMmbr &EClsMmbr::operator=(const EClsMmbr & other)
{
EClsMmbr tmp(other);
swap(tmp);
return *this;
EClsMmbr tmp(other);
swap(tmp);
return *this;
}
void EClsMmbr::swap(EClsMmbr & other)
{
std::swap(expr_, other.expr_);
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
std::swap(pident_, other.pident_);
}
EClsMmbr::~EClsMmbr()
{
delete(expr_);
delete(pident_);
delete(expr_);
delete(pident_);
}
void EClsMmbr::accept(Visitor *v)
{
v->visitEClsMmbr(this);
v->visitEClsMmbr(this);
}
EClsMmbr *EClsMmbr::clone() const
{
return new EClsMmbr(*this);
return new EClsMmbr(*this);
}
......@@ -2103,51 +2103,51 @@ EClsMmbr *EClsMmbr::clone() const
/******************** EClsMthd ********************/
EClsMthd::EClsMthd(Expr *p1, PIdent *p2, ListExpr *p3)
{
expr_ = p1;
pident_ = p2;
listexpr_ = p3;
expr_ = p1;
pident_ = p2;
listexpr_ = p3;
}
EClsMthd::EClsMthd(const EClsMthd & other)
{
expr_ = other.expr_->clone();
pident_ = other.pident_->clone();
listexpr_ = other.listexpr_->clone();
expr_ = other.expr_->clone();
pident_ = other.pident_->clone();
listexpr_ = other.listexpr_->clone();
}
EClsMthd &EClsMthd::operator=(const EClsMthd & other)
{
EClsMthd tmp(other);
swap(tmp);
return *this;
EClsMthd tmp(other);
swap(tmp);
return *this;
}
void EClsMthd::swap(EClsMthd & other)
{
std::swap(expr_, other.expr_);
std::swap(pident_, other.pident_);
std::swap(listexpr_, other.listexpr_);
std::swap(expr_, other.expr_);
std::swap(pident_, other.pident_);
std::swap(listexpr_, other.listexpr_);
}
EClsMthd::~EClsMthd()
{
delete(expr_);
delete(pident_);
delete(listexpr_);
delete(expr_);
delete(pident_);
delete(listexpr_);
}
void EClsMthd::accept(Visitor *v)
{
v->visitEClsMthd(this);
v->visitEClsMthd(this);
}
EClsMthd *EClsMthd::clone() const
{
return new EClsMthd(*this);
return new EClsMthd(*this);
}
......@@ -2165,9 +2165,9 @@ Null::Null(const Null & other)
Null &Null::operator=(const Null & other)
{
Null tmp(other);
swap(tmp);
return *this;
Null tmp(other);
swap(tmp);
return *this;
}
void Null::swap(Null & other)
......@@ -2182,12 +2182,12 @@ Null::~Null()
void Null::accept(Visitor *v)
{
v->visitNull(this);
v->visitNull(this);
}
Null *Null::clone() const
{
return new Null(*this);
return new Null(*this);
}
......@@ -2195,47 +2195,47 @@ Null *Null::clone() const
/******************** EIndexAcc ********************/
EIndexAcc::EIndexAcc(PIdent *p1, Expr *p2)
{
pident_ = p1;
expr_ = p2;
pident_ = p1;
expr_ = p2;
}
EIndexAcc::EIndexAcc(const EIndexAcc & other)
{
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
}
EIndexAcc &EIndexAcc::operator=(const EIndexAcc & other)
{
EIndexAcc tmp(other);
swap(tmp);
return *this;
EIndexAcc tmp(other);
swap(tmp);
return *this;
}
void EIndexAcc::swap(EIndexAcc & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
}
EIndexAcc::~EIndexAcc()
{
delete(pident_);
delete(expr_);
delete(pident_);
delete(expr_);
}
void EIndexAcc::accept(Visitor *v)
{
v->visitEIndexAcc(this);
v->visitEIndexAcc(this);
}
EIndexAcc *EIndexAcc::clone() const
{
return new EIndexAcc(*this);
return new EIndexAcc(*this);
}
......@@ -2243,47 +2243,47 @@ EIndexAcc *EIndexAcc::clone() const
/******************** ECast ********************/
ECast::ECast(PIdent *p1, Expr *p2)
{
pident_ = p1;
expr_ = p2;
pident_ = p1;
expr_ = p2;
}
ECast::ECast(const ECast & other)
{
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
}
ECast &ECast::operator=(const ECast & other)
{
ECast tmp(other);
swap(tmp);
return *this;
ECast tmp(other);
swap(tmp);
return *this;
}
void ECast::swap(ECast & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
}
ECast::~ECast()
{
delete(pident_);
delete(expr_);
delete(pident_);
delete(expr_);
}
void ECast::accept(Visitor *v)
{
v->visitECast(this);
v->visitECast(this);
}
ECast *ECast::clone() const
{
return new ECast(*this);
return new ECast(*this);
}
......@@ -2291,43 +2291,43 @@ ECast *ECast::clone() const
/******************** Neg ********************/
Neg::Neg(Expr *p1)
{
expr_ = p1;
expr_ = p1;
}
Neg::Neg(const Neg & other)
{
expr_ = other.expr_->clone();
expr_ = other.expr_->clone();
}
Neg &Neg::operator=(const Neg & other)
{
Neg tmp(other);
swap(tmp);
return *this;
Neg tmp(other);
swap(tmp);
return *this;
}
void Neg::swap(Neg & other)
{
std::swap(expr_, other.expr_);
std::swap(expr_, other.expr_);
}
Neg::~Neg()
{
delete(expr_);
delete(expr_);
}
void Neg::accept(Visitor *v)
{
v->visitNeg(this);
v->visitNeg(this);
}
Neg *Neg::clone() const
{
return new Neg(*this);
return new Neg(*this);
}
......@@ -2335,43 +2335,43 @@ Neg *Neg::clone() const
/******************** Not ********************/
Not::Not(Expr *p1)
{
expr_ = p1;
expr_ = p1;
}
Not::Not(const Not & other)
{
expr_ = other.expr_->clone();
expr_ = other.expr_->clone();
}
Not &Not::operator=(const Not & other)
{
Not tmp(other);
swap(tmp);
return *this;
Not tmp(other);
swap(tmp);
return *this;
}
void Not::swap(Not & other)
{
std::swap(expr_, other.expr_);
std::swap(expr_, other.expr_);
}
Not::~Not()
{
delete(expr_);
delete(expr_);
}
void Not::accept(Visitor *v)
{
v->visitNot(this);
v->visitNot(this);
}
Not *Not::clone() const
{
return new Not(*this);
return new Not(*this);
}
......@@ -2379,51 +2379,51 @@ Not *Not::clone() const
/******************** EMul ********************/
EMul::EMul(Expr *p1, MulOp *p2, Expr *p3)
{
expr_1 = p1;
mulop_ = p2;
expr_2 = p3;
expr_1 = p1;
mulop_ = p2;
expr_2 = p3;
}
EMul::EMul(const EMul & other)
{
expr_1 = other.expr_1->clone();
mulop_ = other.mulop_->clone();
expr_2 = other.expr_2->clone();
expr_1 = other.expr_1->clone();
mulop_ = other.mulop_->clone();
expr_2 = other.expr_2->clone();
}
EMul &EMul::operator=(const EMul & other)
{
EMul tmp(other);
swap(tmp);
return *this;
EMul tmp(other);
swap(tmp);
return *this;
}
void EMul::swap(EMul & other)
{
std::swap(expr_1, other.expr_1);
std::swap(mulop_, other.mulop_);
std::swap(expr_2, other.expr_2);
std::swap(expr_1, other.expr_1);
std::swap(mulop_, other.mulop_);
std::swap(expr_2, other.expr_2);
}
EMul::~EMul()
{
delete(expr_1);
delete(mulop_);
delete(expr_2);
delete(expr_1);
delete(mulop_);
delete(expr_2);
}
void EMul::accept(Visitor *v)
{
v->visitEMul(this);
v->visitEMul(this);
}
EMul *EMul::clone() const
{
return new EMul(*this);
return new EMul(*this);
}
......@@ -2431,51 +2431,51 @@ EMul *EMul::clone() const
/******************** EAdd ********************/
EAdd::EAdd(Expr *p1, AddOp *p2, Expr *p3)
{
expr_1 = p1;
addop_ = p2;
expr_2 = p3;
expr_1 = p1;
addop_ = p2;
expr_2 = p3;
}
EAdd::EAdd(const EAdd & other)
{
expr_1 = other.expr_1->clone();
addop_ = other.addop_->clone();
expr_2 = other.expr_2->clone();
expr_1 = other.expr_1->clone();
addop_ = other.addop_->clone();
expr_2 = other.expr_2->clone();
}
EAdd &EAdd::operator=(const EAdd & other)
{
EAdd tmp(other);
swap(tmp);
return *this;
EAdd tmp(other);
swap(tmp);
return *this;
}
void EAdd::swap(EAdd & other)
{
std::swap(expr_1, other.expr_1);
std::swap(addop_, other.addop_);
std::swap(expr_2, other.expr_2);
std::swap(expr_1, other.expr_1);
std::swap(addop_, other.addop_);
std::swap(expr_2, other.expr_2);
}
EAdd::~EAdd()
{
delete(expr_1);
delete(addop_);
delete(expr_2);
delete(expr_1);
delete(addop_);
delete(expr_2);
}
void EAdd::accept(Visitor *v)
{
v->visitEAdd(this);
v->visitEAdd(this);
}
EAdd *EAdd::clone() const
{
return new EAdd(*this);
return new EAdd(*this);
}
......@@ -2483,51 +2483,51 @@ EAdd *EAdd::clone() const
/******************** ERel ********************/
ERel::ERel(Expr *p1, RelOp *p2, Expr *p3)
{
expr_1 = p1;
relop_ = p2;
expr_2 = p3;
expr_1 = p1;
relop_ = p2;
expr_2 = p3;
}
ERel::ERel(const ERel & other)
{
expr_1 = other.expr_1->clone();
relop_ = other.relop_->clone();
expr_2 = other.expr_2->clone();
expr_1 = other.expr_1->clone();
relop_ = other.relop_->clone();
expr_2 = other.expr_2->clone();
}
ERel &ERel::operator=(const ERel & other)
{
ERel tmp(other);
swap(tmp);
return *this;
ERel tmp(other);
swap(tmp);
return *this;
}
void ERel::swap(ERel & other)
{
std::swap(expr_1, other.expr_1);
std::swap(relop_, other.relop_);
std::swap(expr_2, other.expr_2);
std::swap(expr_1, other.expr_1);
std::swap(relop_, other.relop_);
std::swap(expr_2, other.expr_2);
}
ERel::~ERel()
{
delete(expr_1);
delete(relop_);
delete(expr_2);
delete(expr_1);
delete(relop_);
delete(expr_2);
}
void ERel::accept(Visitor *v)
{
v->visitERel(this);
v->visitERel(this);
}
ERel *ERel::clone() const
{
return new ERel(*this);
return new ERel(*this);
}
......@@ -2535,47 +2535,47 @@ ERel *ERel::clone() const
/******************** EAnd ********************/
EAnd::EAnd(Expr *p1, Expr *p2)
{
expr_1 = p1;
expr_2 = p2;
expr_1 = p1;
expr_2 = p2;
}
EAnd::EAnd(const EAnd & other)
{
expr_1 = other.expr_1->clone();
expr_2 = other.expr_2->clone();
expr_1 = other.expr_1->clone();
expr_2 = other.expr_2->clone();
}
EAnd &EAnd::operator=(const EAnd & other)
{
EAnd tmp(other);
swap(tmp);
return *this;
EAnd tmp(other);
swap(tmp);
return *this;
}
void EAnd::swap(EAnd & other)
{
std::swap(expr_1, other.expr_1);
std::swap(expr_2, other.expr_2);
std::swap(expr_1, other.expr_1);
std::swap(expr_2, other.expr_2);
}
EAnd::~EAnd()
{
delete(expr_1);
delete(expr_2);
delete(expr_1);
delete(expr_2);
}
void EAnd::accept(Visitor *v)
{
v->visitEAnd(this);
v->visitEAnd(this);
}
EAnd *EAnd::clone() const
{
return new EAnd(*this);
return new EAnd(*this);
}
......@@ -2583,47 +2583,47 @@ EAnd *EAnd::clone() const
/******************** EOr ********************/
EOr::EOr(Expr *p1, Expr *p2)
{
expr_1 = p1;
expr_2 = p2;
expr_1 = p1;
expr_2 = p2;
}
EOr::EOr(const EOr & other)
{
expr_1 = other.expr_1->clone();
expr_2 = other.expr_2->clone();
expr_1 = other.expr_1->clone();
expr_2 = other.expr_2->clone();
}
EOr &EOr::operator=(const EOr & other)
{
EOr tmp(other);
swap(tmp);
return *this;
EOr tmp(other);
swap(tmp);
return *this;
}
void EOr::swap(EOr & other)
{
std::swap(expr_1, other.expr_1);
std::swap(expr_2, other.expr_2);
std::swap(expr_1, other.expr_1);
std::swap(expr_2, other.expr_2);
}
EOr::~EOr()
{
delete(expr_1);
delete(expr_2);
delete(expr_1);
delete(expr_2);
}
void EOr::accept(Visitor *v)
{
v->visitEOr(this);
v->visitEOr(this);
}
EOr *EOr::clone() const
{
return new EOr(*this);
return new EOr(*this);
}
......@@ -2641,9 +2641,9 @@ Plus::Plus(const Plus & other)
Plus &Plus::operator=(const Plus & other)
{
Plus tmp(other);
swap(tmp);
return *this;
Plus tmp(other);
swap(tmp);
return *this;
}
void Plus::swap(Plus & other)
......@@ -2658,12 +2658,12 @@ Plus::~Plus()
void Plus::accept(Visitor *v)
{
v->visitPlus(this);
v->visitPlus(this);
}
Plus *Plus::clone() const
{
return new Plus(*this);
return new Plus(*this);
}
......@@ -2681,9 +2681,9 @@ Minus::Minus(const Minus & other)
Minus &Minus::operator=(const Minus & other)
{
Minus tmp(other);
swap(tmp);
return *this;
Minus tmp(other);
swap(tmp);
return *this;
}
void Minus::swap(Minus & other)
......@@ -2698,12 +2698,12 @@ Minus::~Minus()
void Minus::accept(Visitor *v)
{
v->visitMinus(this);
v->visitMinus(this);
}
Minus *Minus::clone() const
{
return new Minus(*this);
return new Minus(*this);
}
......@@ -2721,9 +2721,9 @@ Times::Times(const Times & other)
Times &Times::operator=(const Times & other)
{
Times tmp(other);
swap(tmp);
return *this;
Times tmp(other);
swap(tmp);
return *this;
}
void Times::swap(Times & other)
......@@ -2738,12 +2738,12 @@ Times::~Times()
void Times::accept(Visitor *v)
{
v->visitTimes(this);
v->visitTimes(this);
}
Times *Times::clone() const
{
return new Times(*this);
return new Times(*this);
}
......@@ -2761,9 +2761,9 @@ Div::Div(const Div & other)
Div &Div::operator=(const Div & other)
{
Div tmp(other);
swap(tmp);
return *this;
Div tmp(other);
swap(tmp);
return *this;
}
void Div::swap(Div & other)
......@@ -2778,12 +2778,12 @@ Div::~Div()
void Div::accept(Visitor *v)
{
v->visitDiv(this);
v->visitDiv(this);
}
Div *Div::clone() const
{
return new Div(*this);
return new Div(*this);
}
......@@ -2801,9 +2801,9 @@ Mod::Mod(const Mod & other)
Mod &Mod::operator=(const Mod & other)
{
Mod tmp(other);
swap(tmp);
return *this;
Mod tmp(other);
swap(tmp);
return *this;
}
void Mod::swap(Mod & other)
......@@ -2818,12 +2818,12 @@ Mod::~Mod()
void Mod::accept(Visitor *v)
{
v->visitMod(this);
v->visitMod(this);
}
Mod *Mod::clone() const
{
return new Mod(*this);
return new Mod(*this);
}
......@@ -2841,9 +2841,9 @@ LTH::LTH(const LTH & other)
LTH &LTH::operator=(const LTH & other)
{
LTH tmp(other);
swap(tmp);
return *this;
LTH tmp(other);
swap(tmp);
return *this;
}
void LTH::swap(LTH & other)
......@@ -2858,12 +2858,12 @@ LTH::~LTH()
void LTH::accept(Visitor *v)
{
v->visitLTH(this);
v->visitLTH(this);
}
LTH *LTH::clone() const
{
return new LTH(*this);
return new LTH(*this);
}
......@@ -2881,9 +2881,9 @@ LE::LE(const LE & other)
LE &LE::operator=(const LE & other)
{
LE tmp(other);
swap(tmp);
return *this;
LE tmp(other);
swap(tmp);
return *this;
}
void LE::swap(LE & other)
......@@ -2898,12 +2898,12 @@ LE::~LE()
void LE::accept(Visitor *v)
{
v->visitLE(this);
v->visitLE(this);
}
LE *LE::clone() const
{
return new LE(*this);
return new LE(*this);
}
......@@ -2921,9 +2921,9 @@ GTH::GTH(const GTH & other)
GTH &GTH::operator=(const GTH & other)
{
GTH tmp(other);
swap(tmp);
return *this;
GTH tmp(other);
swap(tmp);
return *this;
}
void GTH::swap(GTH & other)
......@@ -2938,12 +2938,12 @@ GTH::~GTH()
void GTH::accept(Visitor *v)
{
v->visitGTH(this);
v->visitGTH(this);
}
GTH *GTH::clone() const
{
return new GTH(*this);
return new GTH(*this);
}
......@@ -2961,9 +2961,9 @@ GE::GE(const GE & other)
GE &GE::operator=(const GE & other)
{
GE tmp(other);
swap(tmp);
return *this;
GE tmp(other);
swap(tmp);
return *this;
}
void GE::swap(GE & other)
......@@ -2978,12 +2978,12 @@ GE::~GE()
void GE::accept(Visitor *v)
{
v->visitGE(this);
v->visitGE(this);
}
GE *GE::clone() const
{
return new GE(*this);
return new GE(*this);
}
......@@ -3001,9 +3001,9 @@ EQU::EQU(const EQU & other)
EQU &EQU::operator=(const EQU & other)
{
EQU tmp(other);
swap(tmp);
return *this;
EQU tmp(other);
swap(tmp);
return *this;
}
void EQU::swap(EQU & other)
......@@ -3018,12 +3018,12 @@ EQU::~EQU()
void EQU::accept(Visitor *v)
{
v->visitEQU(this);
v->visitEQU(this);
}
EQU *EQU::clone() const
{
return new EQU(*this);
return new EQU(*this);
}
......@@ -3041,9 +3041,9 @@ NE::NE(const NE & other)
NE &NE::operator=(const NE & other)
{
NE tmp(other);
swap(tmp);
return *this;
NE tmp(other);
swap(tmp);
return *this;
}
void NE::swap(NE & other)
......@@ -3058,12 +3058,12 @@ NE::~NE()
void NE::accept(Visitor *v)
{
v->visitNE(this);
v->visitNE(this);
}
NE *NE::clone() const
{
return new NE(*this);
return new NE(*this);
}
......@@ -3073,13 +3073,13 @@ NE *NE::clone() const
void ListTopDef::accept(Visitor *v)
{
v->visitListTopDef(this);
v->visitListTopDef(this);
}
ListTopDef *ListTopDef::clone() const
{
return new ListTopDef(*this);
return new ListTopDef(*this);
}
......@@ -3087,13 +3087,13 @@ ListTopDef *ListTopDef::clone() const
void ListArg::accept(Visitor *v)
{
v->visitListArg(this);
v->visitListArg(this);
}
ListArg *ListArg::clone() const
{
return new ListArg(*this);
return new ListArg(*this);
}
......@@ -3101,13 +3101,13 @@ ListArg *ListArg::clone() const
void ListClassBlockDef::accept(Visitor *v)
{
v->visitListClassBlockDef(this);
v->visitListClassBlockDef(this);
}
ListClassBlockDef *ListClassBlockDef::clone() const
{
return new ListClassBlockDef(*this);
return new ListClassBlockDef(*this);
}
......@@ -3115,13 +3115,13 @@ ListClassBlockDef *ListClassBlockDef::clone() const
void ListStmt::accept(Visitor *v)
{
v->visitListStmt(this);
v->visitListStmt(this);
}
ListStmt *ListStmt::clone() const
{
return new ListStmt(*this);
return new ListStmt(*this);
}
......@@ -3129,13 +3129,13 @@ ListStmt *ListStmt::clone() const
void ListItem::accept(Visitor *v)
{
v->visitListItem(this);
v->visitListItem(this);
}
ListItem *ListItem::clone() const
{
return new ListItem(*this);
return new ListItem(*this);
}
......@@ -3143,13 +3143,13 @@ ListItem *ListItem::clone() const
void ListType::accept(Visitor *v)
{
v->visitListType(this);
v->visitListType(this);
}
ListType *ListType::clone() const
{
return new ListType(*this);
return new ListType(*this);
}
......@@ -3157,15 +3157,11 @@ ListType *ListType::clone() const
void ListExpr::accept(Visitor *v)
{
v->visitListExpr(this);
v->visitListExpr(this);
}
ListExpr *ListExpr::clone() const
{
return new ListExpr(*this);
return new ListExpr(*this);
}
......@@ -115,104 +115,104 @@ class PIdent;
class Visitor
{
public:
virtual ~Visitor() {}
virtual void visitProgram(Program *p) = 0;
virtual void visitTopDef(TopDef *p) = 0;
virtual void visitFunDef(FunDef *p) = 0;
virtual void visitArg(Arg *p) = 0;
virtual void visitClassDef(ClassDef *p) = 0;
virtual void visitClassBlock(ClassBlock *p) = 0;
virtual void visitClassBlockDef(ClassBlockDef *p) = 0;
virtual void visitBlock(Block *p) = 0;
virtual void visitStmt(Stmt *p) = 0;
virtual void visitItem(Item *p) = 0;
virtual void visitType(Type *p) = 0;
virtual void visitExpr(Expr *p) = 0;
virtual void visitAddOp(AddOp *p) = 0;
virtual void visitMulOp(MulOp *p) = 0;
virtual void visitRelOp(RelOp *p) = 0;
virtual void visitProg(Prog *p) = 0;
virtual void visitFnDef(FnDef *p) = 0;
virtual void visitClDef(ClDef *p) = 0;
virtual void visitFuncDef(FuncDef *p) = 0;
virtual void visitAr(Ar *p) = 0;
virtual void visitClassDefN(ClassDefN *p) = 0;
virtual void visitClassDefE(ClassDefE *p) = 0;
virtual void visitClassBl(ClassBl *p) = 0;
virtual void visitClassMthd(ClassMthd *p) = 0;
virtual void visitClassFld(ClassFld *p) = 0;
virtual void visitBlk(Blk *p) = 0;
virtual void visitEmpty(Empty *p) = 0;
virtual void visitBStmt(BStmt *p) = 0;
virtual void visitDecl(Decl *p) = 0;
virtual void visitNoInit(NoInit *p) = 0;
virtual void visitInit(Init *p) = 0;
virtual void visitAss(Ass *p) = 0;
virtual void visitTableAss(TableAss *p) = 0;
virtual void visitTableIncr(TableIncr *p) = 0;
virtual void visitTableDecr(TableDecr *p) = 0;
virtual void visitIncr(Incr *p) = 0;
virtual void visitDecr(Decr *p) = 0;
virtual void visitRet(Ret *p) = 0;
virtual void visitVRet(VRet *p) = 0;
virtual void visitCond(Cond *p) = 0;
virtual void visitCondElse(CondElse *p) = 0;
virtual void visitWhile(While *p) = 0;
virtual void visitSExp(SExp *p) = 0;
virtual void visitForEach(ForEach *p) = 0;
virtual void visitInt(Int *p) = 0;
virtual void visitStr(Str *p) = 0;
virtual void visitBool(Bool *p) = 0;
virtual void visitVoid(Void *p) = 0;
virtual void visitArray(Array *p) = 0;
virtual void visitClassT(ClassT *p) = 0;
virtual void visitFun(Fun *p) = 0;
virtual void visitEVar(EVar *p) = 0;
virtual void visitELitInt(ELitInt *p) = 0;
virtual void visitELitTrue(ELitTrue *p) = 0;
virtual void visitELitFalse(ELitFalse *p) = 0;
virtual void visitEApp(EApp *p) = 0;
virtual void visitEString(EString *p) = 0;
virtual void visitENewArray(ENewArray *p) = 0;
virtual void visitENewClass(ENewClass *p) = 0;
virtual void visitEClsMmbr(EClsMmbr *p) = 0;
virtual void visitEClsMthd(EClsMthd *p) = 0;
virtual void visitNull(Null *p) = 0;
virtual void visitEIndexAcc(EIndexAcc *p) = 0;
virtual void visitECast(ECast *p) = 0;
virtual void visitNeg(Neg *p) = 0;
virtual void visitNot(Not *p) = 0;
virtual void visitEMul(EMul *p) = 0;
virtual void visitEAdd(EAdd *p) = 0;
virtual void visitERel(ERel *p) = 0;
virtual void visitEAnd(EAnd *p) = 0;
virtual void visitEOr(EOr *p) = 0;
virtual void visitPlus(Plus *p) = 0;
virtual void visitMinus(Minus *p) = 0;
virtual void visitTimes(Times *p) = 0;
virtual void visitDiv(Div *p) = 0;
virtual void visitMod(Mod *p) = 0;
virtual void visitLTH(LTH *p) = 0;
virtual void visitLE(LE *p) = 0;
virtual void visitGTH(GTH *p) = 0;
virtual void visitGE(GE *p) = 0;
virtual void visitEQU(EQU *p) = 0;
virtual void visitNE(NE *p) = 0;
virtual void visitListTopDef(ListTopDef *p) = 0;
virtual void visitListArg(ListArg *p) = 0;
virtual void visitListClassBlockDef(ListClassBlockDef *p) = 0;
virtual void visitListStmt(ListStmt *p) = 0;
virtual void visitListItem(ListItem *p) = 0;
virtual void visitListType(ListType *p) = 0;
virtual void visitListExpr(ListExpr *p) = 0;
virtual void visitPIdent(PIdent *p) = 0;
virtual void visitInteger(Integer x) = 0;
virtual void visitChar(Char x) = 0;
virtual void visitDouble(Double x) = 0;
virtual void visitString(String x) = 0;
virtual void visitIdent(Ident x) = 0;
virtual ~Visitor() {}
virtual void visitProgram(Program *p) = 0;
virtual void visitTopDef(TopDef *p) = 0;
virtual void visitFunDef(FunDef *p) = 0;
virtual void visitArg(Arg *p) = 0;
virtual void visitClassDef(ClassDef *p) = 0;
virtual void visitClassBlock(ClassBlock *p) = 0;
virtual void visitClassBlockDef(ClassBlockDef *p) = 0;
virtual void visitBlock(Block *p) = 0;
virtual void visitStmt(Stmt *p) = 0;
virtual void visitItem(Item *p) = 0;
virtual void visitType(Type *p) = 0;
virtual void visitExpr(Expr *p) = 0;
virtual void visitAddOp(AddOp *p) = 0;
virtual void visitMulOp(MulOp *p) = 0;
virtual void visitRelOp(RelOp *p) = 0;
virtual void visitProg(Prog *p) = 0;
virtual void visitFnDef(FnDef *p) = 0;
virtual void visitClDef(ClDef *p) = 0;
virtual void visitFuncDef(FuncDef *p) = 0;
virtual void visitAr(Ar *p) = 0;
virtual void visitClassDefN(ClassDefN *p) = 0;
virtual void visitClassDefE(ClassDefE *p) = 0;
virtual void visitClassBl(ClassBl *p) = 0;
virtual void visitClassMthd(ClassMthd *p) = 0;
virtual void visitClassFld(ClassFld *p) = 0;
virtual void visitBlk(Blk *p) = 0;
virtual void visitEmpty(Empty *p) = 0;
virtual void visitBStmt(BStmt *p) = 0;
virtual void visitDecl(Decl *p) = 0;
virtual void visitNoInit(NoInit *p) = 0;
virtual void visitInit(Init *p) = 0;
virtual void visitAss(Ass *p) = 0;
virtual void visitTableAss(TableAss *p) = 0;
virtual void visitTableIncr(TableIncr *p) = 0;
virtual void visitTableDecr(TableDecr *p) = 0;
virtual void visitIncr(Incr *p) = 0;
virtual void visitDecr(Decr *p) = 0;
virtual void visitRet(Ret *p) = 0;
virtual void visitVRet(VRet *p) = 0;
virtual void visitCond(Cond *p) = 0;
virtual void visitCondElse(CondElse *p) = 0;
virtual void visitWhile(While *p) = 0;
virtual void visitSExp(SExp *p) = 0;
virtual void visitForEach(ForEach *p) = 0;
virtual void visitInt(Int *p) = 0;
virtual void visitStr(Str *p) = 0;
virtual void visitBool(Bool *p) = 0;
virtual void visitVoid(Void *p) = 0;
virtual void visitArray(Array *p) = 0;
virtual void visitClassT(ClassT *p) = 0;
virtual void visitFun(Fun *p) = 0;
virtual void visitEVar(EVar *p) = 0;
virtual void visitELitInt(ELitInt *p) = 0;
virtual void visitELitTrue(ELitTrue *p) = 0;
virtual void visitELitFalse(ELitFalse *p) = 0;
virtual void visitEApp(EApp *p) = 0;
virtual void visitEString(EString *p) = 0;
virtual void visitENewArray(ENewArray *p) = 0;
virtual void visitENewClass(ENewClass *p) = 0;
virtual void visitEClsMmbr(EClsMmbr *p) = 0;
virtual void visitEClsMthd(EClsMthd *p) = 0;
virtual void visitNull(Null *p) = 0;
virtual void visitEIndexAcc(EIndexAcc *p) = 0;
virtual void visitECast(ECast *p) = 0;
virtual void visitNeg(Neg *p) = 0;
virtual void visitNot(Not *p) = 0;
virtual void visitEMul(EMul *p) = 0;
virtual void visitEAdd(EAdd *p) = 0;
virtual void visitERel(ERel *p) = 0;
virtual void visitEAnd(EAnd *p) = 0;
virtual void visitEOr(EOr *p) = 0;
virtual void visitPlus(Plus *p) = 0;
virtual void visitMinus(Minus *p) = 0;
virtual void visitTimes(Times *p) = 0;
virtual void visitDiv(Div *p) = 0;
virtual void visitMod(Mod *p) = 0;
virtual void visitLTH(LTH *p) = 0;
virtual void visitLE(LE *p) = 0;
virtual void visitGTH(GTH *p) = 0;
virtual void visitGE(GE *p) = 0;
virtual void visitEQU(EQU *p) = 0;
virtual void visitNE(NE *p) = 0;
virtual void visitListTopDef(ListTopDef *p) = 0;
virtual void visitListArg(ListArg *p) = 0;
virtual void visitListClassBlockDef(ListClassBlockDef *p) = 0;
virtual void visitListStmt(ListStmt *p) = 0;
virtual void visitListItem(ListItem *p) = 0;
virtual void visitListType(ListType *p) = 0;
virtual void visitListExpr(ListExpr *p) = 0;
virtual void visitPIdent(PIdent *p) = 0;
virtual void visitInteger(Integer x) = 0;
virtual void visitChar(Char x) = 0;
virtual void visitDouble(Double x) = 0;
virtual void visitString(String x) = 0;
virtual void visitIdent(Ident x) = 0;
};
......@@ -220,8 +220,8 @@ public:
class Visitable
{
public:
virtual ~Visitable() {}
virtual void accept(Visitor *v) = 0;
virtual ~Visitable() {}
virtual void accept(Visitor *v) = 0;
};
......@@ -230,108 +230,108 @@ class Visitable
class Program : public Visitable
{
public:
virtual Program *clone() const = 0;
virtual Program *clone() const = 0;
};
class TopDef : public Visitable
{
public:
virtual TopDef *clone() const = 0;
virtual TopDef *clone() const = 0;
};
class FunDef : public Visitable
{
public:
virtual FunDef *clone() const = 0;
virtual FunDef *clone() const = 0;
};
class Arg : public Visitable
{
public:
virtual Arg *clone() const = 0;
virtual Arg *clone() const = 0;
};
class ClassDef : public Visitable
{
public:
virtual PIdent *getName() const = 0;
virtual PIdent *getParent() const = 0;
virtual ClassBlock *getBlock() const = 0;
virtual ClassDef *clone() const = 0;
virtual PIdent *getName() const = 0;
virtual PIdent *getParent() const = 0;
virtual ClassBlock *getBlock() const = 0;
virtual ClassDef *clone() const = 0;
};
class ClassBlock : public Visitable
{
public:
virtual ClassBlock *clone() const = 0;
virtual ClassBlock *clone() const = 0;
};
class ClassBlockDef : public Visitable
{
public:
virtual ClassBlockDef *clone() const = 0;
virtual ClassBlockDef *clone() const = 0;
};
class Block : public Visitable
{
public:
virtual Block *clone() const = 0;
virtual Block *clone() const = 0;
};
class Stmt : public Visitable
{
public:
virtual Stmt *clone() const = 0;
virtual Stmt *clone() const = 0;
};
class Item : public Visitable
{
public:
virtual Item *clone() const = 0;
virtual Item *clone() const = 0;
};
class Type : public Visitable
{
public:
virtual Type *clone() const = 0;
virtual Type *clone() const = 0;
};
class Expr : public Visitable
{
public:
virtual Expr *clone() const = 0;
virtual Expr *clone() const = 0;
};
class AddOp : public Visitable
{
public:
virtual AddOp *clone() const = 0;
virtual AddOp *clone() const = 0;
};
class MulOp : public Visitable
{
public:
virtual MulOp *clone() const = 0;
virtual MulOp *clone() const = 0;
};
class RelOp : public Visitable
{
public:
virtual RelOp *clone() const = 0;
virtual RelOp *clone() const = 0;
};
......@@ -340,980 +340,980 @@ public:
class PIdent : public Visitable
{
public:
String string_;
Integer integer_;
String string_;
Integer integer_;
PIdent(const PIdent &);
PIdent &operator=(const PIdent &);
PIdent(String p1, Integer p2);
~PIdent();
virtual void accept(Visitor *v);
virtual PIdent *clone() const;
void swap(PIdent &);
PIdent(const PIdent &);
PIdent &operator=(const PIdent &);
PIdent(String p1, Integer p2);
~PIdent();
virtual void accept(Visitor *v);
virtual PIdent *clone() const;
void swap(PIdent &);
};
class Prog : public Program
{
public:
ListTopDef *listtopdef_;
ListTopDef *listtopdef_;
Prog(const Prog &);
Prog &operator=(const Prog &);
Prog(ListTopDef *p1);
~Prog();
virtual void accept(Visitor *v);
virtual Prog *clone() const;
void swap(Prog &);
Prog(const Prog &);
Prog &operator=(const Prog &);
Prog(ListTopDef *p1);
~Prog();
virtual void accept(Visitor *v);
virtual Prog *clone() const;
void swap(Prog &);
};
class FnDef : public TopDef
{
public:
FunDef *fundef_;
FunDef *fundef_;
FnDef(const FnDef &);
FnDef &operator=(const FnDef &);
FnDef(FunDef *p1);
~FnDef();
virtual void accept(Visitor *v);
virtual FnDef *clone() const;
void swap(FnDef &);
FnDef(const FnDef &);
FnDef &operator=(const FnDef &);
FnDef(FunDef *p1);
~FnDef();
virtual void accept(Visitor *v);
virtual FnDef *clone() const;
void swap(FnDef &);
};
class ClDef : public TopDef
{
public:
ClassDef *classdef_;
ClassDef *classdef_;
ClDef(const ClDef &);
ClDef &operator=(const ClDef &);
ClDef(ClassDef *p1);
~ClDef();
virtual void accept(Visitor *v);
virtual ClDef *clone() const;
void swap(ClDef &);
ClDef(const ClDef &);
ClDef &operator=(const ClDef &);
ClDef(ClassDef *p1);
~ClDef();
virtual void accept(Visitor *v);
virtual ClDef *clone() const;
void swap(ClDef &);
};
class FuncDef : public FunDef
{
public:
Type *type_;
PIdent *pident_;
ListArg *listarg_;
Block *block_;
Type *type_;
PIdent *pident_;
ListArg *listarg_;
Block *block_;
FuncDef(const FuncDef &);
FuncDef &operator=(const FuncDef &);
FuncDef(Type *p1, PIdent *p2, ListArg *p3, Block *p4);
~FuncDef();
virtual void accept(Visitor *v);
virtual FuncDef *clone() const;
void swap(FuncDef &);
FuncDef(const FuncDef &);
FuncDef &operator=(const FuncDef &);
FuncDef(Type *p1, PIdent *p2, ListArg *p3, Block *p4);
~FuncDef();
virtual void accept(Visitor *v);
virtual FuncDef *clone() const;
void swap(FuncDef &);
};
class Ar : public Arg
{
public:
Type *type_;
PIdent *pident_;
Type *type_;
PIdent *pident_;
Ar(const Ar &);
Ar &operator=(const Ar &);
Ar(Type *p1, PIdent *p2);
~Ar();
virtual void accept(Visitor *v);
virtual Ar *clone() const;
void swap(Ar &);
Ar(const Ar &);
Ar &operator=(const Ar &);
Ar(Type *p1, PIdent *p2);
~Ar();
virtual void accept(Visitor *v);
virtual Ar *clone() const;
void swap(Ar &);
};
class ClassDefN : public ClassDef
{
public:
PIdent *pident_;
ClassBlock *classblock_;
PIdent *pident_;
ClassBlock *classblock_;
ClassDefN(const ClassDefN &);
ClassDefN &operator=(const ClassDefN &);
ClassDefN(PIdent *p1, ClassBlock *p2);
~ClassDefN();
virtual void accept(Visitor *v);
virtual ClassDefN *clone() const;
void swap(ClassDefN &);
ClassDefN(const ClassDefN &);
ClassDefN &operator=(const ClassDefN &);
ClassDefN(PIdent *p1, ClassBlock *p2);
~ClassDefN();
virtual void accept(Visitor *v);
virtual ClassDefN *clone() const;
void swap(ClassDefN &);
virtual PIdent *getName() const { return pident_; };
virtual PIdent *getParent() const { return NULL; };
virtual ClassBlock *getBlock() const { return classblock_; };
virtual PIdent *getName() const { return pident_; };
virtual PIdent *getParent() const { return NULL; };
virtual ClassBlock *getBlock() const { return classblock_; };
};
class ClassDefE : public ClassDef
{
public:
PIdent *pident_1;
PIdent *pident_2;
ClassBlock *classblock_;
PIdent *pident_1;
PIdent *pident_2;
ClassBlock *classblock_;
ClassDefE(const ClassDefE &);
ClassDefE &operator=(const ClassDefE &);
ClassDefE(PIdent *p1, PIdent *p2, ClassBlock *p3);
~ClassDefE();
virtual void accept(Visitor *v);
virtual ClassDefE *clone() const;
void swap(ClassDefE &);
ClassDefE(const ClassDefE &);
ClassDefE &operator=(const ClassDefE &);
ClassDefE(PIdent *p1, PIdent *p2, ClassBlock *p3);
~ClassDefE();
virtual void accept(Visitor *v);
virtual ClassDefE *clone() const;
void swap(ClassDefE &);
virtual PIdent *getName() const { return pident_1; };
virtual PIdent *getParent() const { return pident_2; };
virtual ClassBlock *getBlock() const { return classblock_; };
virtual PIdent *getName() const { return pident_1; };
virtual PIdent *getParent() const { return pident_2; };
virtual ClassBlock *getBlock() const { return classblock_; };
};
class ClassBl : public ClassBlock
{
public:
ListClassBlockDef *listclassblockdef_;
ListClassBlockDef *listclassblockdef_;
ClassBl(const ClassBl &);
ClassBl &operator=(const ClassBl &);
ClassBl(ListClassBlockDef *p1);
~ClassBl();
virtual void accept(Visitor *v);
virtual ClassBl *clone() const;
void swap(ClassBl &);
ClassBl(const ClassBl &);
ClassBl &operator=(const ClassBl &);
ClassBl(ListClassBlockDef *p1);
~ClassBl();
virtual void accept(Visitor *v);
virtual ClassBl *clone() const;
void swap(ClassBl &);
};
class ClassMthd : public ClassBlockDef
{
public:
FunDef *fundef_;
FunDef *fundef_;
ClassMthd(const ClassMthd &);
ClassMthd &operator=(const ClassMthd &);
ClassMthd(FunDef *p1);
~ClassMthd();
virtual void accept(Visitor *v);
virtual ClassMthd *clone() const;
void swap(ClassMthd &);
ClassMthd(const ClassMthd &);
ClassMthd &operator=(const ClassMthd &);
ClassMthd(FunDef *p1);
~ClassMthd();
virtual void accept(Visitor *v);
virtual ClassMthd *clone() const;
void swap(ClassMthd &);
};
class ClassFld : public ClassBlockDef
{
public:
Type *type_;
ListItem *listitem_;
Type *type_;
ListItem *listitem_;
ClassFld(const ClassFld &);
ClassFld &operator=(const ClassFld &);
ClassFld(Type *p1, ListItem *p2);
~ClassFld();
virtual void accept(Visitor *v);
virtual ClassFld *clone() const;
void swap(ClassFld &);
ClassFld(const ClassFld &);
ClassFld &operator=(const ClassFld &);
ClassFld(Type *p1, ListItem *p2);
~ClassFld();
virtual void accept(Visitor *v);
virtual ClassFld *clone() const;
void swap(ClassFld &);
};
class Blk : public Block
{
public:
ListStmt *liststmt_;
ListStmt *liststmt_;
Blk(const Blk &);
Blk &operator=(const Blk &);
Blk(ListStmt *p1);
~Blk();
virtual void accept(Visitor *v);
virtual Blk *clone() const;
void swap(Blk &);
Blk(const Blk &);
Blk &operator=(const Blk &);
Blk(ListStmt *p1);
~Blk();
virtual void accept(Visitor *v);
virtual Blk *clone() const;
void swap(Blk &);
};
class Empty : public Stmt
{
public:
Empty(const Empty &);
Empty &operator=(const Empty &);
Empty();
~Empty();
virtual void accept(Visitor *v);
virtual Empty *clone() const;
void swap(Empty &);
Empty(const Empty &);
Empty &operator=(const Empty &);
Empty();
~Empty();
virtual void accept(Visitor *v);
virtual Empty *clone() const;
void swap(Empty &);
};
class BStmt : public Stmt
{
public:
Block *block_;
Block *block_;
BStmt(const BStmt &);
BStmt &operator=(const BStmt &);
BStmt(Block *p1);
~BStmt();
virtual void accept(Visitor *v);
virtual BStmt *clone() const;
void swap(BStmt &);
BStmt(const BStmt &);
BStmt &operator=(const BStmt &);
BStmt(Block *p1);
~BStmt();
virtual void accept(Visitor *v);
virtual BStmt *clone() const;
void swap(BStmt &);
};
class Decl : public Stmt
{
public:
Type *type_;
ListItem *listitem_;
Type *type_;
ListItem *listitem_;
Decl(const Decl &);
Decl &operator=(const Decl &);
Decl(Type *p1, ListItem *p2);
~Decl();
virtual void accept(Visitor *v);
virtual Decl *clone() const;
void swap(Decl &);
Decl(const Decl &);
Decl &operator=(const Decl &);
Decl(Type *p1, ListItem *p2);
~Decl();
virtual void accept(Visitor *v);
virtual Decl *clone() const;
void swap(Decl &);
};
class Ass : public Stmt
{
public:
Expr *expr_1;
Expr *expr_2;
Expr *expr_1;
Expr *expr_2;
Ass(const Ass &);
Ass &operator=(const Ass &);
Ass(Expr *p1, Expr *p2);
~Ass();
virtual void accept(Visitor *v);
virtual Ass *clone() const;
void swap(Ass &);
Ass(const Ass &);
Ass &operator=(const Ass &);
Ass(Expr *p1, Expr *p2);
~Ass();
virtual void accept(Visitor *v);
virtual Ass *clone() const;
void swap(Ass &);
};
class TableAss : public Stmt
{
public:
PIdent *pident_;
Expr *expr_1;
Expr *expr_2;
PIdent *pident_;
Expr *expr_1;
Expr *expr_2;
TableAss(const TableAss &);
TableAss &operator=(const TableAss &);
TableAss(PIdent *p1, Expr *p2, Expr *p3);
~TableAss();
virtual void accept(Visitor *v);
virtual TableAss *clone() const;
void swap(TableAss &);
TableAss(const TableAss &);
TableAss &operator=(const TableAss &);
TableAss(PIdent *p1, Expr *p2, Expr *p3);
~TableAss();
virtual void accept(Visitor *v);
virtual TableAss *clone() const;
void swap(TableAss &);
};
class TableIncr : public Stmt
{
public:
PIdent *pident_;
Expr *expr_;
PIdent *pident_;
Expr *expr_;
TableIncr(const TableIncr &);
TableIncr &operator=(const TableIncr &);
TableIncr(PIdent *p1, Expr *p2);
~TableIncr();
virtual void accept(Visitor *v);
virtual TableIncr *clone() const;
void swap(TableIncr &);
TableIncr(const TableIncr &);
TableIncr &operator=(const TableIncr &);
TableIncr(PIdent *p1, Expr *p2);
~TableIncr();
virtual void accept(Visitor *v);
virtual TableIncr *clone() const;
void swap(TableIncr &);
};
class TableDecr : public Stmt
{
public:
PIdent *pident_;
Expr *expr_;
PIdent *pident_;
Expr *expr_;
TableDecr(const TableDecr &);
TableDecr &operator=(const TableDecr &);
TableDecr(PIdent *p1, Expr *p2);
~TableDecr();
virtual void accept(Visitor *v);
virtual TableDecr *clone() const;
void swap(TableDecr &);
TableDecr(const TableDecr &);
TableDecr &operator=(const TableDecr &);
TableDecr(PIdent *p1, Expr *p2);
~TableDecr();
virtual void accept(Visitor *v);
virtual TableDecr *clone() const;
void swap(TableDecr &);
};
class Incr : public Stmt
{
public:
PIdent *pident_;
PIdent *pident_;
Incr(const Incr &);
Incr &operator=(const Incr &);
Incr(PIdent *p1);
~Incr();
virtual void accept(Visitor *v);
virtual Incr *clone() const;
void swap(Incr &);
Incr(const Incr &);
Incr &operator=(const Incr &);
Incr(PIdent *p1);
~Incr();
virtual void accept(Visitor *v);
virtual Incr *clone() const;
void swap(Incr &);
};
class Decr : public Stmt
{
public:
PIdent *pident_;
PIdent *pident_;
Decr(const Decr &);
Decr &operator=(const Decr &);
Decr(PIdent *p1);
~Decr();
virtual void accept(Visitor *v);
virtual Decr *clone() const;
void swap(Decr &);
Decr(const Decr &);
Decr &operator=(const Decr &);
Decr(PIdent *p1);
~Decr();
virtual void accept(Visitor *v);
virtual Decr *clone() const;
void swap(Decr &);
};
class Ret : public Stmt
{
public:
Expr *expr_;
Expr *expr_;
Ret(const Ret &);
Ret &operator=(const Ret &);
Ret(Expr *p1);
~Ret();
virtual void accept(Visitor *v);
virtual Ret *clone() const;
void swap(Ret &);
Ret(const Ret &);
Ret &operator=(const Ret &);
Ret(Expr *p1);
~Ret();
virtual void accept(Visitor *v);
virtual Ret *clone() const;
void swap(Ret &);
};
class VRet : public Stmt
{
public:
VRet(const VRet &);
VRet &operator=(const VRet &);
VRet();
~VRet();
virtual void accept(Visitor *v);
virtual VRet *clone() const;
void swap(VRet &);
VRet(const VRet &);
VRet &operator=(const VRet &);
VRet();
~VRet();
virtual void accept(Visitor *v);
virtual VRet *clone() const;
void swap(VRet &);
};
class Cond : public Stmt
{
public:
Expr *expr_;
Stmt *stmt_;
Expr *expr_;
Stmt *stmt_;
Cond(const Cond &);
Cond &operator=(const Cond &);
Cond(Expr *p1, Stmt *p2);
~Cond();
virtual void accept(Visitor *v);
virtual Cond *clone() const;
void swap(Cond &);
Cond(const Cond &);
Cond &operator=(const Cond &);
Cond(Expr *p1, Stmt *p2);
~Cond();
virtual void accept(Visitor *v);
virtual Cond *clone() const;
void swap(Cond &);
};
class CondElse : public Stmt
{
public:
Expr *expr_;
Stmt *stmt_1;
Stmt *stmt_2;
Expr *expr_;
Stmt *stmt_1;
Stmt *stmt_2;
CondElse(const CondElse &);
CondElse &operator=(const CondElse &);
CondElse(Expr *p1, Stmt *p2, Stmt *p3);
~CondElse();
virtual void accept(Visitor *v);
virtual CondElse *clone() const;
void swap(CondElse &);
CondElse(const CondElse &);
CondElse &operator=(const CondElse &);
CondElse(Expr *p1, Stmt *p2, Stmt *p3);
~CondElse();
virtual void accept(Visitor *v);
virtual CondElse *clone() const;
void swap(CondElse &);
};
class While : public Stmt
{
public:
Expr *expr_;
Stmt *stmt_;
Expr *expr_;
Stmt *stmt_;
While(const While &);
While &operator=(const While &);
While(Expr *p1, Stmt *p2);
~While();
virtual void accept(Visitor *v);
virtual While *clone() const;
void swap(While &);
While(const While &);
While &operator=(const While &);
While(Expr *p1, Stmt *p2);
~While();
virtual void accept(Visitor *v);
virtual While *clone() const;
void swap(While &);
};
class SExp : public Stmt
{
public:
Expr *expr_;
Expr *expr_;
SExp(const SExp &);
SExp &operator=(const SExp &);
SExp(Expr *p1);
~SExp();
virtual void accept(Visitor *v);
virtual SExp *clone() const;
void swap(SExp &);
SExp(const SExp &);
SExp &operator=(const SExp &);
SExp(Expr *p1);
~SExp();
virtual void accept(Visitor *v);
virtual SExp *clone() const;
void swap(SExp &);
};
class ForEach : public Stmt
{
public:
Type *type_;
PIdent *pident_;
Expr *expr_;
Stmt *stmt_;
Type *type_;
PIdent *pident_;
Expr *expr_;
Stmt *stmt_;
ForEach(const ForEach &);
ForEach &operator=(const ForEach &);
ForEach(Type *p1, PIdent *p2, Expr *p3, Stmt *p4);
~ForEach();
virtual void accept(Visitor *v);
virtual ForEach *clone() const;
void swap(ForEach &);
ForEach(const ForEach &);
ForEach &operator=(const ForEach &);
ForEach(Type *p1, PIdent *p2, Expr *p3, Stmt *p4);
~ForEach();
virtual void accept(Visitor *v);
virtual ForEach *clone() const;
void swap(ForEach &);
};
class NoInit : public Item
{
public:
PIdent *pident_;
PIdent *pident_;
NoInit(const NoInit &);
NoInit &operator=(const NoInit &);
NoInit(PIdent *p1);
~NoInit();
virtual void accept(Visitor *v);
virtual NoInit *clone() const;
void swap(NoInit &);
NoInit(const NoInit &);
NoInit &operator=(const NoInit &);
NoInit(PIdent *p1);
~NoInit();
virtual void accept(Visitor *v);
virtual NoInit *clone() const;
void swap(NoInit &);
};
class Init : public Item
{
public:
PIdent *pident_;
Expr *expr_;
PIdent *pident_;
Expr *expr_;
Init(const Init &);
Init &operator=(const Init &);
Init(PIdent *p1, Expr *p2);
~Init();
virtual void accept(Visitor *v);
virtual Init *clone() const;
void swap(Init &);
Init(const Init &);
Init &operator=(const Init &);
Init(PIdent *p1, Expr *p2);
~Init();
virtual void accept(Visitor *v);
virtual Init *clone() const;
void swap(Init &);
};
class Int : public Type
{
public:
Int(const Int &);
Int &operator=(const Int &);
Int();
~Int();
virtual void accept(Visitor *v);
virtual Int *clone() const;
void swap(Int &);
Int(const Int &);
Int &operator=(const Int &);
Int();
~Int();
virtual void accept(Visitor *v);
virtual Int *clone() const;
void swap(Int &);
};
class Str : public Type
{
public:
Str(const Str &);
Str &operator=(const Str &);
Str();
~Str();
virtual void accept(Visitor *v);
virtual Str *clone() const;
void swap(Str &);
Str(const Str &);
Str &operator=(const Str &);
Str();
~Str();
virtual void accept(Visitor *v);
virtual Str *clone() const;
void swap(Str &);
};
class Bool : public Type
{
public:
Bool(const Bool &);
Bool &operator=(const Bool &);
Bool();
~Bool();
virtual void accept(Visitor *v);
virtual Bool *clone() const;
void swap(Bool &);
Bool(const Bool &);
Bool &operator=(const Bool &);
Bool();
~Bool();
virtual void accept(Visitor *v);
virtual Bool *clone() const;
void swap(Bool &);
};
class Void : public Type
{
public:
Void(const Void &);
Void &operator=(const Void &);
Void();
~Void();
virtual void accept(Visitor *v);
virtual Void *clone() const;
void swap(Void &);
Void(const Void &);
Void &operator=(const Void &);
Void();
~Void();
virtual void accept(Visitor *v);
virtual Void *clone() const;
void swap(Void &);
};
class Array : public Type
{
public:
Type *type_;
Type *type_;
Array(const Array &);
Array &operator=(const Array &);
Array(Type *p1);
~Array();
virtual void accept(Visitor *v);
virtual Array *clone() const;
void swap(Array &);
Array(const Array &);
Array &operator=(const Array &);
Array(Type *p1);
~Array();
virtual void accept(Visitor *v);
virtual Array *clone() const;
void swap(Array &);
};
class ClassT : public Type
{
public:
PIdent *pident_;
PIdent *pident_;
ClassT(const ClassT &);
ClassT &operator=(const ClassT &);
ClassT(PIdent *p1);
~ClassT();
virtual void accept(Visitor *v);
virtual ClassT *clone() const;
void swap(ClassT &);
ClassT(const ClassT &);
ClassT &operator=(const ClassT &);
ClassT(PIdent *p1);
~ClassT();
virtual void accept(Visitor *v);
virtual ClassT *clone() const;
void swap(ClassT &);
};
class Fun : public Type
{
public:
Type *type_;
ListType *listtype_;
Type *type_;
ListType *listtype_;
Fun(const Fun &);
Fun &operator=(const Fun &);
Fun(Type *p1, ListType *p2);
~Fun();
virtual void accept(Visitor *v);
virtual Fun *clone() const;
void swap(Fun &);
Fun(const Fun &);
Fun &operator=(const Fun &);
Fun(Type *p1, ListType *p2);
~Fun();
virtual void accept(Visitor *v);
virtual Fun *clone() const;
void swap(Fun &);
};
class EVar : public Expr
{
public:
PIdent *pident_;
PIdent *pident_;
EVar(const EVar &);
EVar &operator=(const EVar &);
EVar(PIdent *p1);
~EVar();
virtual void accept(Visitor *v);
virtual EVar *clone() const;
void swap(EVar &);
EVar(const EVar &);
EVar &operator=(const EVar &);
EVar(PIdent *p1);
~EVar();
virtual void accept(Visitor *v);
virtual EVar *clone() const;
void swap(EVar &);
};
class ELitInt : public Expr
{
public:
Integer integer_;
Integer integer_;
ELitInt(const ELitInt &);
ELitInt &operator=(const ELitInt &);
ELitInt(Integer p1);
~ELitInt();
virtual void accept(Visitor *v);
virtual ELitInt *clone() const;
void swap(ELitInt &);
ELitInt(const ELitInt &);
ELitInt &operator=(const ELitInt &);
ELitInt(Integer p1);
~ELitInt();
virtual void accept(Visitor *v);
virtual ELitInt *clone() const;
void swap(ELitInt &);
};
class ELitTrue : public Expr
{
public:
ELitTrue(const ELitTrue &);
ELitTrue &operator=(const ELitTrue &);
ELitTrue();
~ELitTrue();
virtual void accept(Visitor *v);
virtual ELitTrue *clone() const;
void swap(ELitTrue &);
ELitTrue(const ELitTrue &);
ELitTrue &operator=(const ELitTrue &);
ELitTrue();
~ELitTrue();
virtual void accept(Visitor *v);
virtual ELitTrue *clone() const;
void swap(ELitTrue &);
};
class ELitFalse : public Expr
{
public:
ELitFalse(const ELitFalse &);
ELitFalse &operator=(const ELitFalse &);
ELitFalse();
~ELitFalse();
virtual void accept(Visitor *v);
virtual ELitFalse *clone() const;
void swap(ELitFalse &);
ELitFalse(const ELitFalse &);
ELitFalse &operator=(const ELitFalse &);
ELitFalse();
~ELitFalse();
virtual void accept(Visitor *v);
virtual ELitFalse *clone() const;
void swap(ELitFalse &);
};
class EApp : public Expr
{
public:
PIdent *pident_;
ListExpr *listexpr_;
PIdent *pident_;
ListExpr *listexpr_;
EApp(const EApp &);
EApp &operator=(const EApp &);
EApp(PIdent *p1, ListExpr *p2);
~EApp();
virtual void accept(Visitor *v);
virtual EApp *clone() const;
void swap(EApp &);
EApp(const EApp &);
EApp &operator=(const EApp &);
EApp(PIdent *p1, ListExpr *p2);
~EApp();
virtual void accept(Visitor *v);
virtual EApp *clone() const;
void swap(EApp &);
};
class EString : public Expr
{
public:
String string_;
String string_;
EString(const EString &);
EString &operator=(const EString &);
EString(String p1);
~EString();
virtual void accept(Visitor *v);
virtual EString *clone() const;
void swap(EString &);
EString(const EString &);
EString &operator=(const EString &);
EString(String p1);
~EString();
virtual void accept(Visitor *v);
virtual EString *clone() const;
void swap(EString &);
};
class ENewArray : public Expr
{
public:
Type *type_;
Expr *expr_;
Type *type_;
Expr *expr_;
ENewArray(const ENewArray &);
ENewArray &operator=(const ENewArray &);
ENewArray(Type *p1, Expr *p2);
~ENewArray();
virtual void accept(Visitor *v);
virtual ENewArray *clone() const;
void swap(ENewArray &);
ENewArray(const ENewArray &);
ENewArray &operator=(const ENewArray &);
ENewArray(Type *p1, Expr *p2);
~ENewArray();
virtual void accept(Visitor *v);
virtual ENewArray *clone() const;
void swap(ENewArray &);
};
class ENewClass : public Expr
{
public:
PIdent *pident_;
PIdent *pident_;
ENewClass(const ENewClass &);
ENewClass &operator=(const ENewClass &);
ENewClass(PIdent *p1);
~ENewClass();
virtual void accept(Visitor *v);
virtual ENewClass *clone() const;
void swap(ENewClass &);
ENewClass(const ENewClass &);
ENewClass &operator=(const ENewClass &);
ENewClass(PIdent *p1);
~ENewClass();
virtual void accept(Visitor *v);
virtual ENewClass *clone() const;
void swap(ENewClass &);
};
class EClsMmbr : public Expr
{
public:
Expr *expr_;
PIdent *pident_;
Expr *expr_;
PIdent *pident_;
EClsMmbr(const EClsMmbr &);
EClsMmbr &operator=(const EClsMmbr &);
EClsMmbr(Expr *p1, PIdent *p2);
~EClsMmbr();
virtual void accept(Visitor *v);
virtual EClsMmbr *clone() const;
void swap(EClsMmbr &);
EClsMmbr(const EClsMmbr &);
EClsMmbr &operator=(const EClsMmbr &);
EClsMmbr(Expr *p1, PIdent *p2);
~EClsMmbr();
virtual void accept(Visitor *v);
virtual EClsMmbr *clone() const;
void swap(EClsMmbr &);
};
class EClsMthd : public Expr
{
public:
Expr *expr_;
PIdent *pident_;
ListExpr *listexpr_;
Expr *expr_;
PIdent *pident_;
ListExpr *listexpr_;
EClsMthd(const EClsMthd &);
EClsMthd &operator=(const EClsMthd &);
EClsMthd(Expr *p1, PIdent *p2, ListExpr *p3);
~EClsMthd();
virtual void accept(Visitor *v);
virtual EClsMthd *clone() const;
void swap(EClsMthd &);
EClsMthd(const EClsMthd &);
EClsMthd &operator=(const EClsMthd &);
EClsMthd(Expr *p1, PIdent *p2, ListExpr *p3);
~EClsMthd();
virtual void accept(Visitor *v);
virtual EClsMthd *clone() const;
void swap(EClsMthd &);
};
class Null : public Expr
{
public:
Null(const Null &);
Null &operator=(const Null &);
Null();
~Null();
virtual void accept(Visitor *v);
virtual Null *clone() const;
void swap(Null &);
Null(const Null &);
Null &operator=(const Null &);
Null();
~Null();
virtual void accept(Visitor *v);
virtual Null *clone() const;
void swap(Null &);
};
class EIndexAcc : public Expr
{
public:
PIdent *pident_;
Expr *expr_;
PIdent *pident_;
Expr *expr_;
EIndexAcc(const EIndexAcc &);
EIndexAcc &operator=(const EIndexAcc &);
EIndexAcc(PIdent *p1, Expr *p2);
~EIndexAcc();
virtual void accept(Visitor *v);
virtual EIndexAcc *clone() const;
void swap(EIndexAcc &);
EIndexAcc(const EIndexAcc &);
EIndexAcc &operator=(const EIndexAcc &);
EIndexAcc(PIdent *p1, Expr *p2);
~EIndexAcc();
virtual void accept(Visitor *v);
virtual EIndexAcc *clone() const;
void swap(EIndexAcc &);
};
class ECast : public Expr
{
public:
PIdent *pident_;
Expr *expr_;
PIdent *pident_;
Expr *expr_;
ECast(const ECast &);
ECast &operator=(const ECast &);
ECast(PIdent *p1, Expr *p2);
~ECast();
virtual void accept(Visitor *v);
virtual ECast *clone() const;
void swap(ECast &);
ECast(const ECast &);
ECast &operator=(const ECast &);
ECast(PIdent *p1, Expr *p2);
~ECast();
virtual void accept(Visitor *v);
virtual ECast *clone() const;
void swap(ECast &);
};
class Neg : public Expr
{
public:
Expr *expr_;
Expr *expr_;
Neg(const Neg &);
Neg &operator=(const Neg &);
Neg(Expr *p1);
~Neg();
virtual void accept(Visitor *v);
virtual Neg *clone() const;
void swap(Neg &);
Neg(const Neg &);
Neg &operator=(const Neg &);
Neg(Expr *p1);
~Neg();
virtual void accept(Visitor *v);
virtual Neg *clone() const;
void swap(Neg &);
};
class Not : public Expr
{
public:
Expr *expr_;
Expr *expr_;
Not(const Not &);
Not &operator=(const Not &);
Not(Expr *p1);
~Not();
virtual void accept(Visitor *v);
virtual Not *clone() const;
void swap(Not &);
Not(const Not &);
Not &operator=(const Not &);
Not(Expr *p1);
~Not();
virtual void accept(Visitor *v);
virtual Not *clone() const;
void swap(Not &);
};
class EMul : public Expr
{
public:
Expr *expr_1;
MulOp *mulop_;
Expr *expr_2;
Expr *expr_1;
MulOp *mulop_;
Expr *expr_2;
EMul(const EMul &);
EMul &operator=(const EMul &);
EMul(Expr *p1, MulOp *p2, Expr *p3);
~EMul();
virtual void accept(Visitor *v);
virtual EMul *clone() const;
void swap(EMul &);
EMul(const EMul &);
EMul &operator=(const EMul &);
EMul(Expr *p1, MulOp *p2, Expr *p3);
~EMul();
virtual void accept(Visitor *v);
virtual EMul *clone() const;
void swap(EMul &);
};
class EAdd : public Expr
{
public:
Expr *expr_1;
AddOp *addop_;
Expr *expr_2;
Expr *expr_1;
AddOp *addop_;
Expr *expr_2;
EAdd(const EAdd &);
EAdd &operator=(const EAdd &);
EAdd(Expr *p1, AddOp *p2, Expr *p3);
~EAdd();
virtual void accept(Visitor *v);
virtual EAdd *clone() const;
void swap(EAdd &);
EAdd(const EAdd &);
EAdd &operator=(const EAdd &);
EAdd(Expr *p1, AddOp *p2, Expr *p3);
~EAdd();
virtual void accept(Visitor *v);
virtual EAdd *clone() const;
void swap(EAdd &);
};
class ERel : public Expr
{
public:
Expr *expr_1;
RelOp *relop_;
Expr *expr_2;
Expr *expr_1;
RelOp *relop_;
Expr *expr_2;
ERel(const ERel &);
ERel &operator=(const ERel &);
ERel(Expr *p1, RelOp *p2, Expr *p3);
~ERel();
virtual void accept(Visitor *v);
virtual ERel *clone() const;
void swap(ERel &);
ERel(const ERel &);
ERel &operator=(const ERel &);
ERel(Expr *p1, RelOp *p2, Expr *p3);
~ERel();
virtual void accept(Visitor *v);
virtual ERel *clone() const;
void swap(ERel &);
};
class EAnd : public Expr
{
public:
Expr *expr_1;
Expr *expr_2;
Expr *expr_1;
Expr *expr_2;
EAnd(const EAnd &);
EAnd &operator=(const EAnd &);
EAnd(Expr *p1, Expr *p2);
~EAnd();
virtual void accept(Visitor *v);
virtual EAnd *clone() const;
void swap(EAnd &);
EAnd(const EAnd &);
EAnd &operator=(const EAnd &);
EAnd(Expr *p1, Expr *p2);
~EAnd();
virtual void accept(Visitor *v);
virtual EAnd *clone() const;
void swap(EAnd &);
};
class EOr : public Expr
{
public:
Expr *expr_1;
Expr *expr_2;
Expr *expr_1;
Expr *expr_2;
EOr(const EOr &);
EOr &operator=(const EOr &);
EOr(Expr *p1, Expr *p2);
~EOr();
virtual void accept(Visitor *v);
virtual EOr *clone() const;
void swap(EOr &);
EOr(const EOr &);
EOr &operator=(const EOr &);
EOr(Expr *p1, Expr *p2);
~EOr();
virtual void accept(Visitor *v);
virtual EOr *clone() const;
void swap(EOr &);
};
class Plus : public AddOp
{
public:
Plus(const Plus &);
Plus &operator=(const Plus &);
Plus();
~Plus();
virtual void accept(Visitor *v);
virtual Plus *clone() const;
void swap(Plus &);
Plus(const Plus &);
Plus &operator=(const Plus &);
Plus();
~Plus();
virtual void accept(Visitor *v);
virtual Plus *clone() const;
void swap(Plus &);
};
class Minus : public AddOp
{
public:
Minus(const Minus &);
Minus &operator=(const Minus &);
Minus();
~Minus();
virtual void accept(Visitor *v);
virtual Minus *clone() const;
void swap(Minus &);
Minus(const Minus &);
Minus &operator=(const Minus &);
Minus();
~Minus();
virtual void accept(Visitor *v);
virtual Minus *clone() const;
void swap(Minus &);
};
class Times : public MulOp
{
public:
Times(const Times &);
Times &operator=(const Times &);
Times();
~Times();
virtual void accept(Visitor *v);
virtual Times *clone() const;
void swap(Times &);
Times(const Times &);
Times &operator=(const Times &);
Times();
~Times();
virtual void accept(Visitor *v);
virtual Times *clone() const;
void swap(Times &);
};
class Div : public MulOp
{
public:
Div(const Div &);
Div &operator=(const Div &);
Div();
~Div();
virtual void accept(Visitor *v);
virtual Div *clone() const;
void swap(Div &);
Div(const Div &);
Div &operator=(const Div &);
Div();
~Div();
virtual void accept(Visitor *v);
virtual Div *clone() const;
void swap(Div &);
};
class Mod : public MulOp
{
public:
Mod(const Mod &);
Mod &operator=(const Mod &);
Mod();
~Mod();
virtual void accept(Visitor *v);
virtual Mod *clone() const;
void swap(Mod &);
Mod(const Mod &);
Mod &operator=(const Mod &);
Mod();
~Mod();
virtual void accept(Visitor *v);
virtual Mod *clone() const;
void swap(Mod &);
};
class LTH : public RelOp
{
public:
LTH(const LTH &);
LTH &operator=(const LTH &);
LTH();
~LTH();
virtual void accept(Visitor *v);
virtual LTH *clone() const;
void swap(LTH &);
LTH(const LTH &);
LTH &operator=(const LTH &);
LTH();
~LTH();
virtual void accept(Visitor *v);
virtual LTH *clone() const;
void swap(LTH &);
};
class LE : public RelOp
{
public:
LE(const LE &);
LE &operator=(const LE &);
LE();
~LE();
virtual void accept(Visitor *v);
virtual LE *clone() const;
void swap(LE &);
LE(const LE &);
LE &operator=(const LE &);
LE();
~LE();
virtual void accept(Visitor *v);
virtual LE *clone() const;
void swap(LE &);
};
class GTH : public RelOp
{
public:
GTH(const GTH &);
GTH &operator=(const GTH &);
GTH();
~GTH();
virtual void accept(Visitor *v);
virtual GTH *clone() const;
void swap(GTH &);
GTH(const GTH &);
GTH &operator=(const GTH &);
GTH();
~GTH();
virtual void accept(Visitor *v);
virtual GTH *clone() const;
void swap(GTH &);
};
class GE : public RelOp
{
public:
GE(const GE &);
GE &operator=(const GE &);
GE();
~GE();
virtual void accept(Visitor *v);
virtual GE *clone() const;
void swap(GE &);
GE(const GE &);
GE &operator=(const GE &);
GE();
~GE();
virtual void accept(Visitor *v);
virtual GE *clone() const;
void swap(GE &);
};
class EQU : public RelOp
{
public:
EQU(const EQU &);
EQU &operator=(const EQU &);
EQU();
~EQU();
virtual void accept(Visitor *v);
virtual EQU *clone() const;
void swap(EQU &);
EQU(const EQU &);
EQU &operator=(const EQU &);
EQU();
~EQU();
virtual void accept(Visitor *v);
virtual EQU *clone() const;
void swap(EQU &);
};
class NE : public RelOp
{
public:
NE(const NE &);
NE &operator=(const NE &);
NE();
~NE();
virtual void accept(Visitor *v);
virtual NE *clone() const;
void swap(NE &);
NE(const NE &);
NE &operator=(const NE &);
NE();
~NE();
virtual void accept(Visitor *v);
virtual NE *clone() const;
void swap(NE &);
};
......@@ -1321,50 +1321,50 @@ public:
class ListTopDef : public Visitable, public std::vector<TopDef*>
{
public:
virtual void accept(Visitor *v);
virtual ListTopDef *clone() const;
virtual void accept(Visitor *v);
virtual ListTopDef *clone() const;
};
class ListArg : public Visitable, public std::vector<Arg*>
{
public:
virtual void accept(Visitor *v);
virtual ListArg *clone() const;
virtual void accept(Visitor *v);
virtual ListArg *clone() const;
};
class ListClassBlockDef : public Visitable, public std::vector<ClassBlockDef*>
{
public:
virtual void accept(Visitor *v);
virtual ListClassBlockDef *clone() const;
virtual void accept(Visitor *v);
virtual ListClassBlockDef *clone() const;
};
class ListStmt : public Visitable, public std::vector<Stmt*>
{
public:
virtual void accept(Visitor *v);
virtual ListStmt *clone() const;
virtual void accept(Visitor *v);
virtual ListStmt *clone() const;
};
class ListItem : public Visitable, public std::vector<Item*>
{
public:
virtual void accept(Visitor *v);
virtual ListItem *clone() const;
virtual void accept(Visitor *v);
virtual ListItem *clone() const;
};
class ListType : public Visitable, public std::vector<Type*>
{
public:
virtual void accept(Visitor *v);
virtual ListType *clone() const;
virtual void accept(Visitor *v);
virtual ListType *clone() const;
};
class ListExpr : public Visitable, public std::vector<Expr*>
{
public:
virtual void accept(Visitor *v);
virtual ListExpr *clone() const;
virtual void accept(Visitor *v);
virtual ListExpr *clone() const;
};
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -30,32 +30,32 @@ class RelOp;
typedef union
{
int int_;
char char_;
double double_;
char* string_;
Program* program_;
TopDef* topdef_;
ListTopDef* listtopdef_;
FunDef* fundef_;
Arg* arg_;
ListArg* listarg_;
ClassDef* classdef_;
ClassBlock* classblock_;
ClassBlockDef* classblockdef_;
ListClassBlockDef* listclassblockdef_;
Block* block_;
ListStmt* liststmt_;
Stmt* stmt_;
Item* item_;
ListItem* listitem_;
Type* type_;
ListType* listtype_;
Expr* expr_;
ListExpr* listexpr_;
AddOp* addop_;
MulOp* mulop_;
RelOp* relop_;
int int_;
char char_;
double double_;
char* string_;
Program* program_;
TopDef* topdef_;
ListTopDef* listtopdef_;
FunDef* fundef_;
Arg* arg_;
ListArg* listarg_;
ClassDef* classdef_;
ClassBlock* classblock_;
ClassBlockDef* classblockdef_;
ListClassBlockDef* listclassblockdef_;
Block* block_;
ListStmt* liststmt_;
Stmt* stmt_;
Item* item_;
ListItem* listitem_;
Type* type_;
ListType* listtype_;
Expr* expr_;
ListExpr* listexpr_;
AddOp* addop_;
MulOp* mulop_;
RelOp* relop_;
} YYSTYPE;
Program* pProgram(FILE *inp);
......
......@@ -8,97 +8,97 @@
//You may wish to change render
void PrintAbsyn::render(Char c)
{
if (c == '{')
{
bufAppend('\n');
indent();
bufAppend(c);
_n_ = _n_ + INDENT_WIDTH;
bufAppend('\n');
indent();
}
else if (c == '(' || c == '[')
bufAppend(c);
else if (c == ')' || c == ']')
{
backup();
bufAppend(c);
}
else if (c == '}')
{
int t;
_n_ = _n_ - INDENT_WIDTH;
for (t=0; t<INDENT_WIDTH; t++) {
backup();
}
bufAppend(c);
bufAppend('\n');
indent();
}
else if (c == ',')
{
backup();
bufAppend(c);
bufAppend(' ');
}
else if (c == ';')
{
backup();
bufAppend(c);
bufAppend('\n');
indent();
}
else if (c == 0) return;
else
{
bufAppend(' ');
bufAppend(c);
bufAppend(' ');
}
if (c == '{')
{
bufAppend('\n');
indent();
bufAppend(c);
_n_ = _n_ + INDENT_WIDTH;
bufAppend('\n');
indent();
}
else if (c == '(' || c == '[')
bufAppend(c);
else if (c == ')' || c == ']')
{
backup();
bufAppend(c);
}
else if (c == '}')
{
int t;
_n_ = _n_ - INDENT_WIDTH;
for (t=0; t<INDENT_WIDTH; t++) {
backup();
}
bufAppend(c);
bufAppend('\n');
indent();
}
else if (c == ',')
{
backup();
bufAppend(c);
bufAppend(' ');
}
else if (c == ';')
{
backup();
bufAppend(c);
bufAppend('\n');
indent();
}
else if (c == 0) return;
else
{
bufAppend(' ');
bufAppend(c);
bufAppend(' ');
}
}
void PrintAbsyn::render(String s_)
{
const char *s = s_.c_str() ;
if(strlen(s) > 0)
{
bufAppend(s);
bufAppend(' ');
}
const char *s = s_.c_str() ;
if(strlen(s) > 0)
{
bufAppend(s);
bufAppend(' ');
}
}
void PrintAbsyn::render(const char *s)
{
if(strlen(s) > 0)
{
bufAppend(s);
bufAppend(' ');
}
if(strlen(s) > 0)
{
bufAppend(s);
bufAppend(' ');
}
}
void PrintAbsyn::indent()
{
int n = _n_;
while (n > 0)
{
bufAppend(' ');
n--;
}
int n = _n_;
while (n > 0)
{
bufAppend(' ');
n--;
}
}
void PrintAbsyn::backup()
{
if (buf_[cur_ - 1] == ' ')
{
buf_[cur_ - 1] = 0;
cur_--;
}
if (buf_[cur_ - 1] == ' ')
{
buf_[cur_ - 1] = 0;
cur_--;
}
}
PrintAbsyn::PrintAbsyn(void)
{
_i_ = 0; _n_ = 0;
buf_ = 0;
bufReset();
_i_ = 0; _n_ = 0;
buf_ = 0;
bufReset();
}
PrintAbsyn::~PrintAbsyn(void)
......@@ -107,1053 +107,1053 @@ PrintAbsyn::~PrintAbsyn(void)
char *PrintAbsyn::print(Visitable *v)
{
_i_ = 0; _n_ = 0;
bufReset();
v->accept(this);
return buf_;
_i_ = 0; _n_ = 0;
bufReset();
v->accept(this);
return buf_;
}
void PrintAbsyn::visitPIdent(PIdent *p)
{
visitIdent(p->string_);
visitIdent(p->string_);
}
void PrintAbsyn::visitProgram(Program *p) {} //abstract class
void PrintAbsyn::visitProg(Prog *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
if(p->listtopdef_) {_i_ = 0; p->listtopdef_->accept(this);}
if(p->listtopdef_) {_i_ = 0; p->listtopdef_->accept(this);}
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitTopDef(TopDef *p) {} //abstract class
void PrintAbsyn::visitFnDef(FnDef *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
_i_ = 0; p->fundef_->accept(this);
_i_ = 0; p->fundef_->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitClDef(ClDef *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
_i_ = 0; p->classdef_->accept(this);
_i_ = 0; p->classdef_->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitListTopDef(ListTopDef *listtopdef)
{
for (ListTopDef::const_iterator i = listtopdef->begin() ; i != listtopdef->end() ; ++i)
{
(*i)->accept(this);
if (i != listtopdef->end() - 1) render("");
}
for (ListTopDef::const_iterator i = listtopdef->begin() ; i != listtopdef->end() ; ++i)
{
(*i)->accept(this);
if (i != listtopdef->end() - 1) render("");
}
}void PrintAbsyn::visitFunDef(FunDef *p) {} //abstract class
void PrintAbsyn::visitFuncDef(FuncDef *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
_i_ = 0; p->type_->accept(this);
visitPIdent(p->pident_);
render('(');
if(p->listarg_) {_i_ = 0; p->listarg_->accept(this);}
render(')');
_i_ = 0; p->block_->accept(this);
_i_ = 0; p->type_->accept(this);
visitPIdent(p->pident_);
render('(');
if(p->listarg_) {_i_ = 0; p->listarg_->accept(this);}
render(')');
_i_ = 0; p->block_->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitArg(Arg *p) {} //abstract class
void PrintAbsyn::visitAr(Ar *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
_i_ = 0; p->type_->accept(this);
visitPIdent(p->pident_);
_i_ = 0; p->type_->accept(this);
visitPIdent(p->pident_);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitListArg(ListArg *listarg)
{
for (ListArg::const_iterator i = listarg->begin() ; i != listarg->end() ; ++i)
{
(*i)->accept(this);
if (i != listarg->end() - 1) render(',');
}
for (ListArg::const_iterator i = listarg->begin() ; i != listarg->end() ; ++i)
{
(*i)->accept(this);
if (i != listarg->end() - 1) render(',');
}
}void PrintAbsyn::visitClassDef(ClassDef *p) {} //abstract class
void PrintAbsyn::visitClassDefN(ClassDefN *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("class");
visitPIdent(p->pident_);
_i_ = 0; p->classblock_->accept(this);
render("class");
visitPIdent(p->pident_);
_i_ = 0; p->classblock_->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitClassDefE(ClassDefE *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("class");
visitPIdent(p->pident_1);
render("extends");
visitPIdent(p->pident_2);
_i_ = 0; p->classblock_->accept(this);
render("class");
visitPIdent(p->pident_1);
render("extends");
visitPIdent(p->pident_2);
_i_ = 0; p->classblock_->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitClassBlock(ClassBlock *p) {} //abstract class
void PrintAbsyn::visitClassBl(ClassBl *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render('{');
if(p->listclassblockdef_) {_i_ = 0; p->listclassblockdef_->accept(this);}
render('}');
render('{');
if(p->listclassblockdef_) {_i_ = 0; p->listclassblockdef_->accept(this);}
render('}');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitClassBlockDef(ClassBlockDef *p) {} //abstract class
void PrintAbsyn::visitClassMthd(ClassMthd *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
_i_ = 0; p->fundef_->accept(this);
_i_ = 0; p->fundef_->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitClassFld(ClassFld *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
_i_ = 0; p->type_->accept(this);
if(p->listitem_) {_i_ = 0; p->listitem_->accept(this);}
render(';');
_i_ = 0; p->type_->accept(this);
if(p->listitem_) {_i_ = 0; p->listitem_->accept(this);}
render(';');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitListClassBlockDef(ListClassBlockDef *listclassblockdef)
{
for (ListClassBlockDef::const_iterator i = listclassblockdef->begin() ; i != listclassblockdef->end() ; ++i)
{
(*i)->accept(this);
render("");
}
for (ListClassBlockDef::const_iterator i = listclassblockdef->begin() ; i != listclassblockdef->end() ; ++i)
{
(*i)->accept(this);
render("");
}
}void PrintAbsyn::visitBlock(Block *p) {} //abstract class
void PrintAbsyn::visitBlk(Blk *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render('{');
if(p->liststmt_) {_i_ = 0; p->liststmt_->accept(this);}
render('}');
render('{');
if(p->liststmt_) {_i_ = 0; p->liststmt_->accept(this);}
render('}');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitListStmt(ListStmt *liststmt)
{
for (ListStmt::const_iterator i = liststmt->begin() ; i != liststmt->end() ; ++i)
{
(*i)->accept(this);
render("");
}
for (ListStmt::const_iterator i = liststmt->begin() ; i != liststmt->end() ; ++i)
{
(*i)->accept(this);
render("");
}
}void PrintAbsyn::visitStmt(Stmt *p) {} //abstract class
void PrintAbsyn::visitEmpty(Empty *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render(';');
render(';');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitBStmt(BStmt *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
_i_ = 0; p->block_->accept(this);
_i_ = 0; p->block_->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitDecl(Decl *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
_i_ = 0; p->type_->accept(this);
if(p->listitem_) {_i_ = 0; p->listitem_->accept(this);}
render(';');
_i_ = 0; p->type_->accept(this);
if(p->listitem_) {_i_ = 0; p->listitem_->accept(this);}
render(';');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitAss(Ass *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
_i_ = 0; p->expr_1->accept(this);
render('=');
_i_ = 0; p->expr_2->accept(this);
render(';');
_i_ = 0; p->expr_1->accept(this);
render('=');
_i_ = 0; p->expr_2->accept(this);
render(';');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitTableAss(TableAss *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
render('[');
_i_ = 0; p->expr_1->accept(this);
render(']');
render('=');
_i_ = 0; p->expr_2->accept(this);
render(';');
visitPIdent(p->pident_);
render('[');
_i_ = 0; p->expr_1->accept(this);
render(']');
render('=');
_i_ = 0; p->expr_2->accept(this);
render(';');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitTableIncr(TableIncr *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
render("++");
render(';');
visitPIdent(p->pident_);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
render("++");
render(';');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitTableDecr(TableDecr *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
render("--");
render(';');
visitPIdent(p->pident_);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
render("--");
render(';');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitIncr(Incr *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
render("++");
render(';');
visitPIdent(p->pident_);
render("++");
render(';');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitDecr(Decr *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
render("--");
render(';');
visitPIdent(p->pident_);
render("--");
render(';');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitRet(Ret *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("return");
_i_ = 0; p->expr_->accept(this);
render(';');
render("return");
_i_ = 0; p->expr_->accept(this);
render(';');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitVRet(VRet *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("return");
render(';');
render("return");
render(';');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitCond(Cond *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("if");
render('(');
_i_ = 0; p->expr_->accept(this);
render(')');
_i_ = 0; p->stmt_->accept(this);
render("if");
render('(');
_i_ = 0; p->expr_->accept(this);
render(')');
_i_ = 0; p->stmt_->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitCondElse(CondElse *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("if");
render('(');
_i_ = 0; p->expr_->accept(this);
render(')');
_i_ = 0; p->stmt_1->accept(this);
render("else");
_i_ = 0; p->stmt_2->accept(this);
render("if");
render('(');
_i_ = 0; p->expr_->accept(this);
render(')');
_i_ = 0; p->stmt_1->accept(this);
render("else");
_i_ = 0; p->stmt_2->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitWhile(While *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("while");
render('(');
_i_ = 0; p->expr_->accept(this);
render(')');
_i_ = 0; p->stmt_->accept(this);
render("while");
render('(');
_i_ = 0; p->expr_->accept(this);
render(')');
_i_ = 0; p->stmt_->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitSExp(SExp *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
_i_ = 0; p->expr_->accept(this);
render(';');
_i_ = 0; p->expr_->accept(this);
render(';');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitForEach(ForEach *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("for");
render('(');
_i_ = 0; p->type_->accept(this);
visitPIdent(p->pident_);
render(':');
_i_ = 0; p->expr_->accept(this);
render(')');
_i_ = 0; p->stmt_->accept(this);
render("for");
render('(');
_i_ = 0; p->type_->accept(this);
visitPIdent(p->pident_);
render(':');
_i_ = 0; p->expr_->accept(this);
render(')');
_i_ = 0; p->stmt_->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitItem(Item *p) {} //abstract class
void PrintAbsyn::visitNoInit(NoInit *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
visitPIdent(p->pident_);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitInit(Init *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
render('=');
_i_ = 0; p->expr_->accept(this);
visitPIdent(p->pident_);
render('=');
_i_ = 0; p->expr_->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitListItem(ListItem *listitem)
{
for (ListItem::const_iterator i = listitem->begin() ; i != listitem->end() ; ++i)
{
(*i)->accept(this);
if (i != listitem->end() - 1) render(',');
}
for (ListItem::const_iterator i = listitem->begin() ; i != listitem->end() ; ++i)
{
(*i)->accept(this);
if (i != listitem->end() - 1) render(',');
}
}void PrintAbsyn::visitType(Type *p) {} //abstract class
void PrintAbsyn::visitInt(Int *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("int");
render("int");
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitStr(Str *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("string");
render("string");
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitBool(Bool *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("boolean");
render("boolean");
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitVoid(Void *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("void");
render("void");
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitArray(Array *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
_i_ = 0; p->type_->accept(this);
render('[');
render(']');
_i_ = 0; p->type_->accept(this);
render('[');
render(']');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitClassT(ClassT *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
visitPIdent(p->pident_);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitFun(Fun *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
/* Internal Category */
/* Internal Category */
_i_ = 0; p->type_->accept(this);
render('(');
if(p->listtype_) {_i_ = 0; p->listtype_->accept(this);}
render(')');
_i_ = 0; p->type_->accept(this);
render('(');
if(p->listtype_) {_i_ = 0; p->listtype_->accept(this);}
render(')');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitListType(ListType *listtype)
{
for (ListType::const_iterator i = listtype->begin() ; i != listtype->end() ; ++i)
{
(*i)->accept(this);
if (i != listtype->end() - 1) render(',');
}
for (ListType::const_iterator i = listtype->begin() ; i != listtype->end() ; ++i)
{
(*i)->accept(this);
if (i != listtype->end() - 1) render(',');
}
}void PrintAbsyn::visitExpr(Expr *p) {} //abstract class
void PrintAbsyn::visitEVar(EVar *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
visitPIdent(p->pident_);
visitPIdent(p->pident_);
if (oldi > 6) render(_R_PAREN);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitELitInt(ELitInt *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
visitInteger(p->integer_);
visitInteger(p->integer_);
if (oldi > 6) render(_R_PAREN);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitELitTrue(ELitTrue *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
render("true");
render("true");
if (oldi > 6) render(_R_PAREN);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitELitFalse(ELitFalse *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
render("false");
render("false");
if (oldi > 6) render(_R_PAREN);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitEApp(EApp *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
visitPIdent(p->pident_);
render('(');
if(p->listexpr_) {_i_ = 0; p->listexpr_->accept(this);}
render(')');
visitPIdent(p->pident_);
render('(');
if(p->listexpr_) {_i_ = 0; p->listexpr_->accept(this);}
render(')');
if (oldi > 6) render(_R_PAREN);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitEString(EString *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
visitString(p->string_);
visitString(p->string_);
if (oldi > 6) render(_R_PAREN);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitENewArray(ENewArray *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
render("new");
_i_ = 0; p->type_->accept(this);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
render("new");
_i_ = 0; p->type_->accept(this);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
if (oldi > 6) render(_R_PAREN);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitENewClass(ENewClass *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
render("new");
visitPIdent(p->pident_);
render("new");
visitPIdent(p->pident_);
if (oldi > 6) render(_R_PAREN);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitEClsMmbr(EClsMmbr *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
_i_ = 6; p->expr_->accept(this);
render('.');
visitPIdent(p->pident_);
_i_ = 6; p->expr_->accept(this);
render('.');
visitPIdent(p->pident_);
if (oldi > 6) render(_R_PAREN);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitEClsMthd(EClsMthd *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
_i_ = 6; p->expr_->accept(this);
render('.');
visitPIdent(p->pident_);
render('(');
if(p->listexpr_) {_i_ = 0; p->listexpr_->accept(this);}
render(')');
_i_ = 6; p->expr_->accept(this);
render('.');
visitPIdent(p->pident_);
render('(');
if(p->listexpr_) {_i_ = 0; p->listexpr_->accept(this);}
render(')');
if (oldi > 6) render(_R_PAREN);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitNull(Null *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
render("null");
render("null");
if (oldi > 6) render(_R_PAREN);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitEIndexAcc(EIndexAcc *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
visitPIdent(p->pident_);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
visitPIdent(p->pident_);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
if (oldi > 6) render(_R_PAREN);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitECast(ECast *p)
{
int oldi = _i_;
if (oldi > 5) render(_L_PAREN);
int oldi = _i_;
if (oldi > 5) render(_L_PAREN);
render('(');
visitPIdent(p->pident_);
render(')');
_i_ = 5; p->expr_->accept(this);
render('(');
visitPIdent(p->pident_);
render(')');
_i_ = 5; p->expr_->accept(this);
if (oldi > 5) render(_R_PAREN);
if (oldi > 5) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitNeg(Neg *p)
{
int oldi = _i_;
if (oldi > 5) render(_L_PAREN);
int oldi = _i_;
if (oldi > 5) render(_L_PAREN);
render('-');
_i_ = 6; p->expr_->accept(this);
render('-');
_i_ = 6; p->expr_->accept(this);
if (oldi > 5) render(_R_PAREN);
if (oldi > 5) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitNot(Not *p)
{
int oldi = _i_;
if (oldi > 5) render(_L_PAREN);
int oldi = _i_;
if (oldi > 5) render(_L_PAREN);
render('!');
_i_ = 6; p->expr_->accept(this);
render('!');
_i_ = 6; p->expr_->accept(this);
if (oldi > 5) render(_R_PAREN);
if (oldi > 5) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitEMul(EMul *p)
{
int oldi = _i_;
if (oldi > 4) render(_L_PAREN);
int oldi = _i_;
if (oldi > 4) render(_L_PAREN);
_i_ = 4; p->expr_1->accept(this);
_i_ = 0; p->mulop_->accept(this);
_i_ = 5; p->expr_2->accept(this);
_i_ = 4; p->expr_1->accept(this);
_i_ = 0; p->mulop_->accept(this);
_i_ = 5; p->expr_2->accept(this);
if (oldi > 4) render(_R_PAREN);
if (oldi > 4) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitEAdd(EAdd *p)
{
int oldi = _i_;
if (oldi > 3) render(_L_PAREN);
int oldi = _i_;
if (oldi > 3) render(_L_PAREN);
_i_ = 3; p->expr_1->accept(this);
_i_ = 0; p->addop_->accept(this);
_i_ = 4; p->expr_2->accept(this);
_i_ = 3; p->expr_1->accept(this);
_i_ = 0; p->addop_->accept(this);
_i_ = 4; p->expr_2->accept(this);
if (oldi > 3) render(_R_PAREN);
if (oldi > 3) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitERel(ERel *p)
{
int oldi = _i_;
if (oldi > 2) render(_L_PAREN);
int oldi = _i_;
if (oldi > 2) render(_L_PAREN);
_i_ = 2; p->expr_1->accept(this);
_i_ = 0; p->relop_->accept(this);
_i_ = 3; p->expr_2->accept(this);
_i_ = 2; p->expr_1->accept(this);
_i_ = 0; p->relop_->accept(this);
_i_ = 3; p->expr_2->accept(this);
if (oldi > 2) render(_R_PAREN);
if (oldi > 2) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitEAnd(EAnd *p)
{
int oldi = _i_;
if (oldi > 1) render(_L_PAREN);
int oldi = _i_;
if (oldi > 1) render(_L_PAREN);
_i_ = 2; p->expr_1->accept(this);
render("&&");
_i_ = 1; p->expr_2->accept(this);
_i_ = 2; p->expr_1->accept(this);
render("&&");
_i_ = 1; p->expr_2->accept(this);
if (oldi > 1) render(_R_PAREN);
if (oldi > 1) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitEOr(EOr *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
_i_ = 1; p->expr_1->accept(this);
render("||");
_i_ = 0; p->expr_2->accept(this);
_i_ = 1; p->expr_1->accept(this);
render("||");
_i_ = 0; p->expr_2->accept(this);
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitListExpr(ListExpr *listexpr)
{
for (ListExpr::const_iterator i = listexpr->begin() ; i != listexpr->end() ; ++i)
{
(*i)->accept(this);
if (i != listexpr->end() - 1) render(',');
}
for (ListExpr::const_iterator i = listexpr->begin() ; i != listexpr->end() ; ++i)
{
(*i)->accept(this);
if (i != listexpr->end() - 1) render(',');
}
}void PrintAbsyn::visitAddOp(AddOp *p) {} //abstract class
void PrintAbsyn::visitPlus(Plus *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render('+');
render('+');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitMinus(Minus *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render('-');
render('-');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitMulOp(MulOp *p) {} //abstract class
void PrintAbsyn::visitTimes(Times *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render('*');
render('*');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitDiv(Div *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render('/');
render('/');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitMod(Mod *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render('%');
render('%');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitRelOp(RelOp *p) {} //abstract class
void PrintAbsyn::visitLTH(LTH *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render('<');
render('<');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitLE(LE *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("<=");
render("<=");
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitGTH(GTH *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render('>');
render('>');
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitGE(GE *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render(">=");
render(">=");
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitEQU(EQU *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("==");
render("==");
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitNE(NE *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
render("!=");
render("!=");
if (oldi > 0) render(_R_PAREN);
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
_i_ = oldi;
}
void PrintAbsyn::visitInteger(Integer i)
{
char tmp[16];
sprintf(tmp, "%d", i);
bufAppend(tmp);
char tmp[16];
sprintf(tmp, "%d", i);
bufAppend(tmp);
}
void PrintAbsyn::visitDouble(Double d)
{
char tmp[16];
sprintf(tmp, "%g", d);
bufAppend(tmp);
char tmp[16];
sprintf(tmp, "%g", d);
bufAppend(tmp);
}
void PrintAbsyn::visitChar(Char c)
{
bufAppend('\'');
bufAppend(c);
bufAppend('\'');
bufAppend('\'');
bufAppend(c);
bufAppend('\'');
}
void PrintAbsyn::visitString(String s)
{
bufAppend('\"');
bufAppend(s);
bufAppend('\"');
bufAppend('\"');
bufAppend(s);
bufAppend('\"');
}
void PrintAbsyn::visitIdent(String s)
{
render(s);
render(s);
}
void PrintAbsyn::visitPIdent(String s)
{
render(s);
render(s);
}
ShowAbsyn::ShowAbsyn(void)
{
buf_ = 0;
bufReset();
buf_ = 0;
bufReset();
}
ShowAbsyn::~ShowAbsyn(void)
......@@ -1162,794 +1162,794 @@ ShowAbsyn::~ShowAbsyn(void)
char *ShowAbsyn::show(Visitable *v)
{
bufReset();
v->accept(this);
return buf_;
bufReset();
v->accept(this);
return buf_;
}
void ShowAbsyn::visitPIdent(PIdent *p)
{
bufAppend('(');
bufAppend("PIdent");
bufAppend(' ');
visitString(p->string_);
bufAppend(' ');
visitInteger(p->integer_);
bufAppend(')');
bufAppend('(');
bufAppend("PIdent");
bufAppend(' ');
visitString(p->string_);
bufAppend(' ');
visitInteger(p->integer_);
bufAppend(')');
}
void ShowAbsyn::visitProgram(Program *p) {} //abstract class
void ShowAbsyn::visitProg(Prog *p)
{
bufAppend('(');
bufAppend("Prog");
bufAppend(' ');
bufAppend('[');
if (p->listtopdef_) p->listtopdef_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("Prog");
bufAppend(' ');
bufAppend('[');
if (p->listtopdef_) p->listtopdef_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitTopDef(TopDef *p) {} //abstract class
void ShowAbsyn::visitFnDef(FnDef *p)
{
bufAppend('(');
bufAppend("FnDef");
bufAppend(' ');
bufAppend('[');
if (p->fundef_) p->fundef_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("FnDef");
bufAppend(' ');
bufAppend('[');
if (p->fundef_) p->fundef_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitClDef(ClDef *p)
{
bufAppend('(');
bufAppend("ClDef");
bufAppend(' ');
bufAppend('[');
if (p->classdef_) p->classdef_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("ClDef");
bufAppend(' ');
bufAppend('[');
if (p->classdef_) p->classdef_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitListTopDef(ListTopDef *listtopdef)
{
for (ListTopDef::const_iterator i = listtopdef->begin() ; i != listtopdef->end() ; ++i)
{
(*i)->accept(this);
if (i != listtopdef->end() - 1) bufAppend(", ");
}
for (ListTopDef::const_iterator i = listtopdef->begin() ; i != listtopdef->end() ; ++i)
{
(*i)->accept(this);
if (i != listtopdef->end() - 1) bufAppend(", ");
}
}
void ShowAbsyn::visitFunDef(FunDef *p) {} //abstract class
void ShowAbsyn::visitFuncDef(FuncDef *p)
{
bufAppend('(');
bufAppend("FuncDef");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->listarg_) p->listarg_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->block_) p->block_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("FuncDef");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->listarg_) p->listarg_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->block_) p->block_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitArg(Arg *p) {} //abstract class
void ShowAbsyn::visitAr(Ar *p)
{
bufAppend('(');
bufAppend("Ar");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
bufAppend('(');
bufAppend("Ar");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
}
void ShowAbsyn::visitListArg(ListArg *listarg)
{
for (ListArg::const_iterator i = listarg->begin() ; i != listarg->end() ; ++i)
{
(*i)->accept(this);
if (i != listarg->end() - 1) bufAppend(", ");
}
for (ListArg::const_iterator i = listarg->begin() ; i != listarg->end() ; ++i)
{
(*i)->accept(this);
if (i != listarg->end() - 1) bufAppend(", ");
}
}
void ShowAbsyn::visitClassDef(ClassDef *p) {} //abstract class
void ShowAbsyn::visitClassDefN(ClassDefN *p)
{
bufAppend('(');
bufAppend("ClassDefN");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->classblock_) p->classblock_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("ClassDefN");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->classblock_) p->classblock_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitClassDefE(ClassDefE *p)
{
bufAppend('(');
bufAppend("ClassDefE");
bufAppend(' ');
visitPIdent(p->pident_1);
bufAppend(' ');
visitPIdent(p->pident_2);
bufAppend(' ');
bufAppend('[');
if (p->classblock_) p->classblock_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("ClassDefE");
bufAppend(' ');
visitPIdent(p->pident_1);
bufAppend(' ');
visitPIdent(p->pident_2);
bufAppend(' ');
bufAppend('[');
if (p->classblock_) p->classblock_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitClassBlock(ClassBlock *p) {} //abstract class
void ShowAbsyn::visitClassBl(ClassBl *p)
{
bufAppend('(');
bufAppend("ClassBl");
bufAppend(' ');
bufAppend('[');
if (p->listclassblockdef_) p->listclassblockdef_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("ClassBl");
bufAppend(' ');
bufAppend('[');
if (p->listclassblockdef_) p->listclassblockdef_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitClassBlockDef(ClassBlockDef *p) {} //abstract class
void ShowAbsyn::visitClassMthd(ClassMthd *p)
{
bufAppend('(');
bufAppend("ClassMthd");
bufAppend(' ');
bufAppend('[');
if (p->fundef_) p->fundef_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("ClassMthd");
bufAppend(' ');
bufAppend('[');
if (p->fundef_) p->fundef_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitClassFld(ClassFld *p)
{
bufAppend('(');
bufAppend("ClassFld");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->listitem_) p->listitem_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("ClassFld");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->listitem_) p->listitem_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitListClassBlockDef(ListClassBlockDef *listclassblockdef)
{
for (ListClassBlockDef::const_iterator i = listclassblockdef->begin() ; i != listclassblockdef->end() ; ++i)
{
(*i)->accept(this);
if (i != listclassblockdef->end() - 1) bufAppend(", ");
}
for (ListClassBlockDef::const_iterator i = listclassblockdef->begin() ; i != listclassblockdef->end() ; ++i)
{
(*i)->accept(this);
if (i != listclassblockdef->end() - 1) bufAppend(", ");
}
}
void ShowAbsyn::visitBlock(Block *p) {} //abstract class
void ShowAbsyn::visitBlk(Blk *p)
{
bufAppend('(');
bufAppend("Blk");
bufAppend(' ');
bufAppend('[');
if (p->liststmt_) p->liststmt_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("Blk");
bufAppend(' ');
bufAppend('[');
if (p->liststmt_) p->liststmt_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitListStmt(ListStmt *liststmt)
{
for (ListStmt::const_iterator i = liststmt->begin() ; i != liststmt->end() ; ++i)
{
(*i)->accept(this);
if (i != liststmt->end() - 1) bufAppend(", ");
}
for (ListStmt::const_iterator i = liststmt->begin() ; i != liststmt->end() ; ++i)
{
(*i)->accept(this);
if (i != liststmt->end() - 1) bufAppend(", ");
}
}
void ShowAbsyn::visitStmt(Stmt *p) {} //abstract class
void ShowAbsyn::visitEmpty(Empty *p)
{
bufAppend("Empty");
bufAppend("Empty");
}
void ShowAbsyn::visitBStmt(BStmt *p)
{
bufAppend('(');
bufAppend("BStmt");
bufAppend(' ');
bufAppend('[');
if (p->block_) p->block_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("BStmt");
bufAppend(' ');
bufAppend('[');
if (p->block_) p->block_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitDecl(Decl *p)
{
bufAppend('(');
bufAppend("Decl");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->listitem_) p->listitem_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("Decl");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->listitem_) p->listitem_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitAss(Ass *p)
{
bufAppend('(');
bufAppend("Ass");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("Ass");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitTableAss(TableAss *p)
{
bufAppend('(');
bufAppend("TableAss");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("TableAss");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitTableIncr(TableIncr *p)
{
bufAppend('(');
bufAppend("TableIncr");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("TableIncr");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitTableDecr(TableDecr *p)
{
bufAppend('(');
bufAppend("TableDecr");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("TableDecr");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitIncr(Incr *p)
{
bufAppend('(');
bufAppend("Incr");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("Incr");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitDecr(Decr *p)
{
bufAppend('(');
bufAppend("Decr");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("Decr");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitRet(Ret *p)
{
bufAppend('(');
bufAppend("Ret");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("Ret");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitVRet(VRet *p)
{
bufAppend("VRet");
bufAppend("VRet");
}
void ShowAbsyn::visitCond(Cond *p)
{
bufAppend('(');
bufAppend("Cond");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->stmt_) p->stmt_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("Cond");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->stmt_) p->stmt_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitCondElse(CondElse *p)
{
bufAppend('(');
bufAppend("CondElse");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
p->stmt_1->accept(this);
bufAppend(' ');
p->stmt_2->accept(this);
bufAppend(')');
bufAppend('(');
bufAppend("CondElse");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
p->stmt_1->accept(this);
bufAppend(' ');
p->stmt_2->accept(this);
bufAppend(')');
}
void ShowAbsyn::visitWhile(While *p)
{
bufAppend('(');
bufAppend("While");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->stmt_) p->stmt_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("While");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->stmt_) p->stmt_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitSExp(SExp *p)
{
bufAppend('(');
bufAppend("SExp");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("SExp");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitForEach(ForEach *p)
{
bufAppend('(');
bufAppend("ForEa.h");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->stmt_) p->stmt_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("ForEa.h");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->stmt_) p->stmt_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitItem(Item *p) {} //abstract class
void ShowAbsyn::visitNoInit(NoInit *p)
{
bufAppend('(');
bufAppend("NoInit");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
bufAppend('(');
bufAppend("NoInit");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
}
void ShowAbsyn::visitInit(Init *p)
{
bufAppend('(');
bufAppend("Init");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("Init");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitListItem(ListItem *listitem)
{
for (ListItem::const_iterator i = listitem->begin() ; i != listitem->end() ; ++i)
{
(*i)->accept(this);
if (i != listitem->end() - 1) bufAppend(", ");
}
for (ListItem::const_iterator i = listitem->begin() ; i != listitem->end() ; ++i)
{
(*i)->accept(this);
if (i != listitem->end() - 1) bufAppend(", ");
}
}
void ShowAbsyn::visitType(Type *p) {} //abstract class
void ShowAbsyn::visitInt(Int *p)
{
bufAppend("Int");
bufAppend("Int");
}
void ShowAbsyn::visitStr(Str *p)
{
bufAppend("Str");
bufAppend("Str");
}
void ShowAbsyn::visitBool(Bool *p)
{
bufAppend("Bool");
bufAppend("Bool");
}
void ShowAbsyn::visitVoid(Void *p)
{
bufAppend("Void");
bufAppend("Void");
}
void ShowAbsyn::visitArray(Array *p)
{
bufAppend('(');
bufAppend("Array");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("Array");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitClassT(ClassT *p)
{
bufAppend('(');
bufAppend("ClassT");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
bufAppend('(');
bufAppend("ClassT");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
}
void ShowAbsyn::visitFun(Fun *p)
{
bufAppend('(');
bufAppend("Fun");
bufAppend(' ');
bufAppend('(');
bufAppend("Fun");
bufAppend(' ');
/* Internal Category */
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->listtype_) p->listtype_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->listtype_) p->listtype_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitListType(ListType *listtype)
{
for (ListType::const_iterator i = listtype->begin() ; i != listtype->end() ; ++i)
{
(*i)->accept(this);
if (i != listtype->end() - 1) bufAppend(", ");
}
for (ListType::const_iterator i = listtype->begin() ; i != listtype->end() ; ++i)
{
(*i)->accept(this);
if (i != listtype->end() - 1) bufAppend(", ");
}
}
void ShowAbsyn::visitExpr(Expr *p) {} //abstract class
void ShowAbsyn::visitEVar(EVar *p)
{
bufAppend('(');
bufAppend("EVar");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
bufAppend('(');
bufAppend("EVar");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
}
void ShowAbsyn::visitELitInt(ELitInt *p)
{
bufAppend('(');
bufAppend("ELitInt");
bufAppend(' ');
visitInteger(p->integer_);
bufAppend(')');
bufAppend('(');
bufAppend("ELitInt");
bufAppend(' ');
visitInteger(p->integer_);
bufAppend(')');
}
void ShowAbsyn::visitELitTrue(ELitTrue *p)
{
bufAppend("ELitTrue");
bufAppend("ELitTrue");
}
void ShowAbsyn::visitELitFalse(ELitFalse *p)
{
bufAppend("ELitFalse");
bufAppend("ELitFalse");
}
void ShowAbsyn::visitEApp(EApp *p)
{
bufAppend('(');
bufAppend("EApp");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->listexpr_) p->listexpr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("EApp");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->listexpr_) p->listexpr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitEString(EString *p)
{
bufAppend('(');
bufAppend("EString");
bufAppend(' ');
visitString(p->string_);
bufAppend(')');
bufAppend('(');
bufAppend("EString");
bufAppend(' ');
visitString(p->string_);
bufAppend(')');
}
void ShowAbsyn::visitENewArray(ENewArray *p)
{
bufAppend('(');
bufAppend("ENewArray");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("ENewArray");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitENewClass(ENewClass *p)
{
bufAppend('(');
bufAppend("ENewClass");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
bufAppend('(');
bufAppend("ENewClass");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
}
void ShowAbsyn::visitEClsMmbr(EClsMmbr *p)
{
bufAppend('(');
bufAppend("EClsMmbr");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
bufAppend('(');
bufAppend("EClsMmbr");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
}
void ShowAbsyn::visitEClsMthd(EClsMthd *p)
{
bufAppend('(');
bufAppend("EClsMthd");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->listexpr_) p->listexpr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("EClsMthd");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->listexpr_) p->listexpr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitNull(Null *p)
{
bufAppend("Null");
bufAppend("Null");
}
void ShowAbsyn::visitEIndexAcc(EIndexAcc *p)
{
bufAppend('(');
bufAppend("EIndexAcc");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
bufAppend('(');
bufAppend("EIndexAcc");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitECast(ECast *p)
{
bufAppend('(');
bufAppend("ECast");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("ECast");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitNeg(Neg *p)
{
bufAppend('(');
bufAppend("Neg");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("Neg");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitNot(Not *p)
{
bufAppend('(');
bufAppend("Not");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(')');
bufAppend('(');
bufAppend("Not");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(')');
}
void ShowAbsyn::visitEMul(EMul *p)
{
bufAppend('(');
bufAppend("EMul");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
bufAppend('[');
if (p->mulop_) p->mulop_->accept(this);
bufAppend(']');
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(')');
bufAppend('(');
bufAppend("EMul");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
bufAppend('[');
if (p->mulop_) p->mulop_->accept(this);
bufAppend(']');
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(')');
}
void ShowAbsyn::visitEAdd(EAdd *p)
{
bufAppend('(');
bufAppend("EAdd");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
bufAppend('[');
if (p->addop_) p->addop_->accept(this);
bufAppend(']');
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(')');
bufAppend('(');
bufAppend("EAdd");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
bufAppend('[');
if (p->addop_) p->addop_->accept(this);
bufAppend(']');
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(')');
}
void ShowAbsyn::visitERel(ERel *p)
{
bufAppend('(');
bufAppend("ERel");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
bufAppend('[');
if (p->relop_) p->relop_->accept(this);
bufAppend(']');
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(')');
bufAppend('(');
bufAppend("ERel");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
bufAppend('[');
if (p->relop_) p->relop_->accept(this);
bufAppend(']');
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(')');
}
void ShowAbsyn::visitEAnd(EAnd *p)
{
bufAppend('(');
bufAppend("EAnd");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(')');
bufAppend('(');
bufAppend("EAnd");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(')');
}
void ShowAbsyn::visitEOr(EOr *p)
{
bufAppend('(');
bufAppend("EOr");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(')');
bufAppend('(');
bufAppend("EOr");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(')');
}
void ShowAbsyn::visitListExpr(ListExpr *listexpr)
{
for (ListExpr::const_iterator i = listexpr->begin() ; i != listexpr->end() ; ++i)
{
(*i)->accept(this);
if (i != listexpr->end() - 1) bufAppend(", ");
}
for (ListExpr::const_iterator i = listexpr->begin() ; i != listexpr->end() ; ++i)
{
(*i)->accept(this);
if (i != listexpr->end() - 1) bufAppend(", ");
}
}
void ShowAbsyn::visitAddOp(AddOp *p) {} //abstract class
void ShowAbsyn::visitPlus(Plus *p)
{
bufAppend("Plus");
bufAppend("Plus");
}
void ShowAbsyn::visitMinus(Minus *p)
{
bufAppend("Minus");
bufAppend("Minus");
}
void ShowAbsyn::visitMulOp(MulOp *p) {} //abstract class
void ShowAbsyn::visitTimes(Times *p)
{
bufAppend("Times");
bufAppend("Times");
}
void ShowAbsyn::visitDiv(Div *p)
{
bufAppend("Div");
bufAppend("Div");
}
void ShowAbsyn::visitMod(Mod *p)
{
bufAppend("Mod");
bufAppend("Mod");
}
void ShowAbsyn::visitRelOp(RelOp *p) {} //abstract class
void ShowAbsyn::visitLTH(LTH *p)
{
bufAppend("L.h");
bufAppend("L.h");
}
void ShowAbsyn::visitLE(LE *p)
{
bufAppend("LE");
bufAppend("LE");
}
void ShowAbsyn::visitGTH(GTH *p)
{
bufAppend("G.h");
bufAppend("G.h");
}
void ShowAbsyn::visitGE(GE *p)
{
bufAppend("GE");
bufAppend("GE");
}
void ShowAbsyn::visitEQU(EQU *p)
{
bufAppend("EQU");
bufAppend("EQU");
}
void ShowAbsyn::visitNE(NE *p)
{
bufAppend("NE");
bufAppend("NE");
}
void ShowAbsyn::visitInteger(Integer i)
{
char tmp[16];
sprintf(tmp, "%d", i);
bufAppend(tmp);
char tmp[16];
sprintf(tmp, "%d", i);
bufAppend(tmp);
}
void ShowAbsyn::visitDouble(Double d)
{
char tmp[16];
sprintf(tmp, "%g", d);
bufAppend(tmp);
char tmp[16];
sprintf(tmp, "%g", d);
bufAppend(tmp);
}
void ShowAbsyn::visitChar(Char c)
{
bufAppend('\'');
bufAppend(c);
bufAppend('\'');
bufAppend('\'');
bufAppend(c);
bufAppend('\'');
}
void ShowAbsyn::visitString(String s)
{
bufAppend('\"');
bufAppend(s);
bufAppend('\"');
bufAppend('\"');
bufAppend(s);
bufAppend('\"');
}
void ShowAbsyn::visitIdent(String s)
{
bufAppend('\"');
bufAppend(s);
bufAppend('\"');
bufAppend('\"');
bufAppend(s);
bufAppend('\"');
}
void ShowAbsyn::visitPIdent(String s)
{
bufAppend('\"');
bufAppend(s);
bufAppend('\"');
bufAppend('\"');
bufAppend(s);
bufAppend('\"');
}
......
......@@ -16,181 +16,181 @@
class PrintAbsyn : public Visitor
{
protected:
int _n_, _i_;
/* The following are simple heuristics for rendering terminals */
/* You may wish to change them */
void render(Char c);
void render(String s);
void render(const char *s);
void indent(void);
void backup(void);
int _n_, _i_;
/* The following are simple heuristics for rendering terminals */
/* You may wish to change them */
void render(Char c);
void render(String s);
void render(const char *s);
void indent(void);
void backup(void);
public:
PrintAbsyn(void);
~PrintAbsyn(void);
char *print(Visitable *v);
PrintAbsyn(void);
~PrintAbsyn(void);
char *print(Visitable *v);
void visitPIdent(PIdent *p);
void visitProgram(Program *p); /* abstract class */
void visitProg(Prog *p);
void visitTopDef(TopDef *p); /* abstract class */
void visitFnDef(FnDef *p);
void visitClDef(ClDef *p);
void visitListTopDef(ListTopDef *p);
void visitFunDef(FunDef *p); /* abstract class */
void visitFuncDef(FuncDef *p);
void visitArg(Arg *p); /* abstract class */
void visitAr(Ar *p);
void visitListArg(ListArg *p);
void visitClassDef(ClassDef *p); /* abstract class */
void visitClassDefN(ClassDefN *p);
void visitClassDefE(ClassDefE *p);
void visitClassBlock(ClassBlock *p); /* abstract class */
void visitClassBl(ClassBl *p);
void visitClassBlockDef(ClassBlockDef *p); /* abstract class */
void visitClassMthd(ClassMthd *p);
void visitClassFld(ClassFld *p);
void visitListClassBlockDef(ListClassBlockDef *p);
void visitBlock(Block *p); /* abstract class */
void visitBlk(Blk *p);
void visitListStmt(ListStmt *p);
void visitStmt(Stmt *p); /* abstract class */
void visitEmpty(Empty *p);
void visitBStmt(BStmt *p);
void visitDecl(Decl *p);
void visitAss(Ass *p);
void visitTableAss(TableAss *p);
void visitTableIncr(TableIncr *p);
void visitTableDecr(TableDecr *p);
void visitIncr(Incr *p);
void visitDecr(Decr *p);
void visitRet(Ret *p);
void visitVRet(VRet *p);
void visitCond(Cond *p);
void visitCondElse(CondElse *p);
void visitWhile(While *p);
void visitSExp(SExp *p);
void visitForEach(ForEach *p);
void visitItem(Item *p); /* abstract class */
void visitNoInit(NoInit *p);
void visitInit(Init *p);
void visitListItem(ListItem *p);
void visitType(Type *p); /* abstract class */
void visitInt(Int *p);
void visitStr(Str *p);
void visitBool(Bool *p);
void visitVoid(Void *p);
void visitArray(Array *p);
void visitClassT(ClassT *p);
void visitFun(Fun *p);
void visitListType(ListType *p);
void visitExpr(Expr *p); /* abstract class */
void visitEVar(EVar *p);
void visitELitInt(ELitInt *p);
void visitELitTrue(ELitTrue *p);
void visitELitFalse(ELitFalse *p);
void visitEApp(EApp *p);
void visitEString(EString *p);
void visitENewArray(ENewArray *p);
void visitENewClass(ENewClass *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEClsMthd(EClsMthd *p);
void visitNull(Null *p);
void visitEIndexAcc(EIndexAcc *p);
void visitECast(ECast *p);
void visitNeg(Neg *p);
void visitNot(Not *p);
void visitEMul(EMul *p);
void visitEAdd(EAdd *p);
void visitERel(ERel *p);
void visitEAnd(EAnd *p);
void visitEOr(EOr *p);
void visitListExpr(ListExpr *p);
void visitAddOp(AddOp *p); /* abstract class */
void visitPlus(Plus *p);
void visitMinus(Minus *p);
void visitMulOp(MulOp *p); /* abstract class */
void visitTimes(Times *p);
void visitDiv(Div *p);
void visitMod(Mod *p);
void visitRelOp(RelOp *p); /* abstract class */
void visitLTH(LTH *p);
void visitLE(LE *p);
void visitGTH(GTH *p);
void visitGE(GE *p);
void visitEQU(EQU *p);
void visitNE(NE *p);
void visitPIdent(PIdent *p);
void visitProgram(Program *p); /* abstract class */
void visitProg(Prog *p);
void visitTopDef(TopDef *p); /* abstract class */
void visitFnDef(FnDef *p);
void visitClDef(ClDef *p);
void visitListTopDef(ListTopDef *p);
void visitFunDef(FunDef *p); /* abstract class */
void visitFuncDef(FuncDef *p);
void visitArg(Arg *p); /* abstract class */
void visitAr(Ar *p);
void visitListArg(ListArg *p);
void visitClassDef(ClassDef *p); /* abstract class */
void visitClassDefN(ClassDefN *p);
void visitClassDefE(ClassDefE *p);
void visitClassBlock(ClassBlock *p); /* abstract class */
void visitClassBl(ClassBl *p);
void visitClassBlockDef(ClassBlockDef *p); /* abstract class */
void visitClassMthd(ClassMthd *p);
void visitClassFld(ClassFld *p);
void visitListClassBlockDef(ListClassBlockDef *p);
void visitBlock(Block *p); /* abstract class */
void visitBlk(Blk *p);
void visitListStmt(ListStmt *p);
void visitStmt(Stmt *p); /* abstract class */
void visitEmpty(Empty *p);
void visitBStmt(BStmt *p);
void visitDecl(Decl *p);
void visitAss(Ass *p);
void visitTableAss(TableAss *p);
void visitTableIncr(TableIncr *p);
void visitTableDecr(TableDecr *p);
void visitIncr(Incr *p);
void visitDecr(Decr *p);
void visitRet(Ret *p);
void visitVRet(VRet *p);
void visitCond(Cond *p);
void visitCondElse(CondElse *p);
void visitWhile(While *p);
void visitSExp(SExp *p);
void visitForEach(ForEach *p);
void visitItem(Item *p); /* abstract class */
void visitNoInit(NoInit *p);
void visitInit(Init *p);
void visitListItem(ListItem *p);
void visitType(Type *p); /* abstract class */
void visitInt(Int *p);
void visitStr(Str *p);
void visitBool(Bool *p);
void visitVoid(Void *p);
void visitArray(Array *p);
void visitClassT(ClassT *p);
void visitFun(Fun *p);
void visitListType(ListType *p);
void visitExpr(Expr *p); /* abstract class */
void visitEVar(EVar *p);
void visitELitInt(ELitInt *p);
void visitELitTrue(ELitTrue *p);
void visitELitFalse(ELitFalse *p);
void visitEApp(EApp *p);
void visitEString(EString *p);
void visitENewArray(ENewArray *p);
void visitENewClass(ENewClass *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEClsMthd(EClsMthd *p);
void visitNull(Null *p);
void visitEIndexAcc(EIndexAcc *p);
void visitECast(ECast *p);
void visitNeg(Neg *p);
void visitNot(Not *p);
void visitEMul(EMul *p);
void visitEAdd(EAdd *p);
void visitERel(ERel *p);
void visitEAnd(EAnd *p);
void visitEOr(EOr *p);
void visitListExpr(ListExpr *p);
void visitAddOp(AddOp *p); /* abstract class */
void visitPlus(Plus *p);
void visitMinus(Minus *p);
void visitMulOp(MulOp *p); /* abstract class */
void visitTimes(Times *p);
void visitDiv(Div *p);
void visitMod(Mod *p);
void visitRelOp(RelOp *p); /* abstract class */
void visitLTH(LTH *p);
void visitLE(LE *p);
void visitGTH(GTH *p);
void visitGE(GE *p);
void visitEQU(EQU *p);
void visitNE(NE *p);
void visitInteger(Integer i);
void visitDouble(Double d);
void visitChar(Char c);
void visitString(String s);
void visitIdent(String s);
void visitPIdent(String s);
void visitInteger(Integer i);
void visitDouble(Double d);
void visitChar(Char c);
void visitString(String s);
void visitIdent(String s);
void visitPIdent(String s);
protected:
char *buf_;
int cur_, buf_size;
char *buf_;
int cur_, buf_size;
void inline bufAppend(const char *s)
{
int len = strlen(s);
while (cur_ + len >= buf_size)
{
buf_size *= 2; /* Double the buffer size */
}
resizeBuffer();
for(int n = 0; n < len; n++)
{
buf_[cur_ + n] = s[n];
}
cur_ += len;
buf_[cur_] = 0;
}
void inline bufAppend(const char *s)
{
int len = strlen(s);
while (cur_ + len >= buf_size)
{
buf_size *= 2; /* Double the buffer size */
}
resizeBuffer();
for(int n = 0; n < len; n++)
{
buf_[cur_ + n] = s[n];
}
cur_ += len;
buf_[cur_] = 0;
}
void inline bufAppend(const char c)
{
if (cur_ >= buf_size)
{
buf_size *= 2; /* Double the buffer size */
resizeBuffer();
}
buf_[cur_] = c;
cur_++;
buf_[cur_] = 0;
}
void inline bufAppend(const char c)
{
if (cur_ >= buf_size)
{
buf_size *= 2; /* Double the buffer size */
resizeBuffer();
}
buf_[cur_] = c;
cur_++;
buf_[cur_] = 0;
}
void inline bufAppend(String str)
{
const char *s = str.c_str();
bufAppend(s);
}
void inline bufReset(void)
{
if (buf_) free(buf_);
buf_size = BUFFER_INITIAL;
buf_ = (char *) malloc(buf_size);
if (!buf_) {
fprintf(stderr, "Error: Out of memory while allocating buffer!\n");
exit(1);
}
memset(buf_, 0, buf_size);
cur_ = 0;
}
void inline bufAppend(String str)
{
const char *s = str.c_str();
bufAppend(s);
}
void inline bufReset(void)
{
if (buf_) free(buf_);
buf_size = BUFFER_INITIAL;
buf_ = (char *) malloc(buf_size);
if (!buf_) {
fprintf(stderr, "Error: Out of memory while allocating buffer!\n");
exit(1);
}
memset(buf_, 0, buf_size);
cur_ = 0;
}
void inline resizeBuffer(void)
{
char *temp = (char *) malloc(buf_size);
if (!temp)
{
fprintf(stderr, "Error: Out of memory while attempting to grow buffer!\n");
exit(1);
}
if (buf_)
{
strcpy(temp, buf_);
free(buf_);
}
buf_ = temp;
}
void inline resizeBuffer(void)
{
char *temp = (char *) malloc(buf_size);
if (!temp)
{
fprintf(stderr, "Error: Out of memory while attempting to grow buffer!\n");
exit(1);
}
if (buf_)
{
strcpy(temp, buf_);
free(buf_);
}
buf_ = temp;
}
};
......@@ -198,172 +198,172 @@ class PrintAbsyn : public Visitor
class ShowAbsyn : public Visitor
{
public:
ShowAbsyn(void);
~ShowAbsyn(void);
char *show(Visitable *v);
ShowAbsyn(void);
~ShowAbsyn(void);
char *show(Visitable *v);
void visitPIdent(PIdent *p);
void visitProgram(Program *p); /* abstract class */
void visitProg(Prog *p);
void visitTopDef(TopDef *p); /* abstract class */
void visitFnDef(FnDef *p);
void visitClDef(ClDef *p);
void visitListTopDef(ListTopDef *p);
void visitFunDef(FunDef *p); /* abstract class */
void visitFuncDef(FuncDef *p);
void visitArg(Arg *p); /* abstract class */
void visitAr(Ar *p);
void visitListArg(ListArg *p);
void visitClassDef(ClassDef *p); /* abstract class */
void visitClassDefN(ClassDefN *p);
void visitClassDefE(ClassDefE *p);
void visitClassBlock(ClassBlock *p); /* abstract class */
void visitClassBl(ClassBl *p);
void visitClassBlockDef(ClassBlockDef *p); /* abstract class */
void visitClassMthd(ClassMthd *p);
void visitClassFld(ClassFld *p);
void visitListClassBlockDef(ListClassBlockDef *p);
void visitBlock(Block *p); /* abstract class */
void visitBlk(Blk *p);
void visitListStmt(ListStmt *p);
void visitStmt(Stmt *p); /* abstract class */
void visitEmpty(Empty *p);
void visitBStmt(BStmt *p);
void visitDecl(Decl *p);
void visitAss(Ass *p);
void visitTableAss(TableAss *p);
void visitTableIncr(TableIncr *p);
void visitTableDecr(TableDecr *p);
void visitIncr(Incr *p);
void visitDecr(Decr *p);
void visitRet(Ret *p);
void visitVRet(VRet *p);
void visitCond(Cond *p);
void visitCondElse(CondElse *p);
void visitWhile(While *p);
void visitSExp(SExp *p);
void visitForEach(ForEach *p);
void visitItem(Item *p); /* abstract class */
void visitNoInit(NoInit *p);
void visitInit(Init *p);
void visitListItem(ListItem *p);
void visitType(Type *p); /* abstract class */
void visitInt(Int *p);
void visitStr(Str *p);
void visitBool(Bool *p);
void visitVoid(Void *p);
void visitArray(Array *p);
void visitClassT(ClassT *p);
void visitFun(Fun *p);
void visitListType(ListType *p);
void visitExpr(Expr *p); /* abstract class */
void visitEVar(EVar *p);
void visitELitInt(ELitInt *p);
void visitELitTrue(ELitTrue *p);
void visitELitFalse(ELitFalse *p);
void visitEApp(EApp *p);
void visitEString(EString *p);
void visitENewArray(ENewArray *p);
void visitENewClass(ENewClass *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEClsMthd(EClsMthd *p);
void visitNull(Null *p);
void visitEIndexAcc(EIndexAcc *p);
void visitECast(ECast *p);
void visitNeg(Neg *p);
void visitNot(Not *p);
void visitEMul(EMul *p);
void visitEAdd(EAdd *p);
void visitERel(ERel *p);
void visitEAnd(EAnd *p);
void visitEOr(EOr *p);
void visitListExpr(ListExpr *p);
void visitAddOp(AddOp *p); /* abstract class */
void visitPlus(Plus *p);
void visitMinus(Minus *p);
void visitMulOp(MulOp *p); /* abstract class */
void visitTimes(Times *p);
void visitDiv(Div *p);
void visitMod(Mod *p);
void visitRelOp(RelOp *p); /* abstract class */
void visitLTH(LTH *p);
void visitLE(LE *p);
void visitGTH(GTH *p);
void visitGE(GE *p);
void visitEQU(EQU *p);
void visitNE(NE *p);
void visitPIdent(PIdent *p);
void visitProgram(Program *p); /* abstract class */
void visitProg(Prog *p);
void visitTopDef(TopDef *p); /* abstract class */
void visitFnDef(FnDef *p);
void visitClDef(ClDef *p);
void visitListTopDef(ListTopDef *p);
void visitFunDef(FunDef *p); /* abstract class */
void visitFuncDef(FuncDef *p);
void visitArg(Arg *p); /* abstract class */
void visitAr(Ar *p);
void visitListArg(ListArg *p);
void visitClassDef(ClassDef *p); /* abstract class */
void visitClassDefN(ClassDefN *p);
void visitClassDefE(ClassDefE *p);
void visitClassBlock(ClassBlock *p); /* abstract class */
void visitClassBl(ClassBl *p);
void visitClassBlockDef(ClassBlockDef *p); /* abstract class */
void visitClassMthd(ClassMthd *p);
void visitClassFld(ClassFld *p);
void visitListClassBlockDef(ListClassBlockDef *p);
void visitBlock(Block *p); /* abstract class */
void visitBlk(Blk *p);
void visitListStmt(ListStmt *p);
void visitStmt(Stmt *p); /* abstract class */
void visitEmpty(Empty *p);
void visitBStmt(BStmt *p);
void visitDecl(Decl *p);
void visitAss(Ass *p);
void visitTableAss(TableAss *p);
void visitTableIncr(TableIncr *p);
void visitTableDecr(TableDecr *p);
void visitIncr(Incr *p);
void visitDecr(Decr *p);
void visitRet(Ret *p);
void visitVRet(VRet *p);
void visitCond(Cond *p);
void visitCondElse(CondElse *p);
void visitWhile(While *p);
void visitSExp(SExp *p);
void visitForEach(ForEach *p);
void visitItem(Item *p); /* abstract class */
void visitNoInit(NoInit *p);
void visitInit(Init *p);
void visitListItem(ListItem *p);
void visitType(Type *p); /* abstract class */
void visitInt(Int *p);
void visitStr(Str *p);
void visitBool(Bool *p);
void visitVoid(Void *p);
void visitArray(Array *p);
void visitClassT(ClassT *p);
void visitFun(Fun *p);
void visitListType(ListType *p);
void visitExpr(Expr *p); /* abstract class */
void visitEVar(EVar *p);
void visitELitInt(ELitInt *p);
void visitELitTrue(ELitTrue *p);
void visitELitFalse(ELitFalse *p);
void visitEApp(EApp *p);
void visitEString(EString *p);
void visitENewArray(ENewArray *p);
void visitENewClass(ENewClass *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEClsMthd(EClsMthd *p);
void visitNull(Null *p);
void visitEIndexAcc(EIndexAcc *p);
void visitECast(ECast *p);
void visitNeg(Neg *p);
void visitNot(Not *p);
void visitEMul(EMul *p);
void visitEAdd(EAdd *p);
void visitERel(ERel *p);
void visitEAnd(EAnd *p);
void visitEOr(EOr *p);
void visitListExpr(ListExpr *p);
void visitAddOp(AddOp *p); /* abstract class */
void visitPlus(Plus *p);
void visitMinus(Minus *p);
void visitMulOp(MulOp *p); /* abstract class */
void visitTimes(Times *p);
void visitDiv(Div *p);
void visitMod(Mod *p);
void visitRelOp(RelOp *p); /* abstract class */
void visitLTH(LTH *p);
void visitLE(LE *p);
void visitGTH(GTH *p);
void visitGE(GE *p);
void visitEQU(EQU *p);
void visitNE(NE *p);
void visitInteger(Integer i);
void visitDouble(Double d);
void visitChar(Char c);
void visitString(String s);
void visitIdent(String s);
void visitPIdent(String s);
void visitInteger(Integer i);
void visitDouble(Double d);
void visitChar(Char c);
void visitString(String s);
void visitIdent(String s);
void visitPIdent(String s);
protected:
char *buf_;
int cur_, buf_size;
char *buf_;
int cur_, buf_size;
void inline bufAppend(const char *s)
{
int len = strlen(s);
while (cur_ + len >= buf_size)
{
buf_size *= 2; /* Double the buffer size */
}
resizeBuffer();
for(int n = 0; n < len; n++)
{
buf_[cur_ + n] = s[n];
}
cur_ += len;
buf_[cur_] = 0;
}
void inline bufAppend(const char *s)
{
int len = strlen(s);
while (cur_ + len >= buf_size)
{
buf_size *= 2; /* Double the buffer size */
}
resizeBuffer();
for(int n = 0; n < len; n++)
{
buf_[cur_ + n] = s[n];
}
cur_ += len;
buf_[cur_] = 0;
}
void inline bufAppend(const char c)
{
if (cur_ >= buf_size)
{
buf_size *= 2; /* Double the buffer size */
resizeBuffer();
}
buf_[cur_] = c;
cur_++;
buf_[cur_] = 0;
}
void inline bufAppend(const char c)
{
if (cur_ >= buf_size)
{
buf_size *= 2; /* Double the buffer size */
resizeBuffer();
}
buf_[cur_] = c;
cur_++;
buf_[cur_] = 0;
}
void inline bufAppend(String str)
{
const char *s = str.c_str();
bufAppend(s);
}
void inline bufReset(void)
{
if (buf_) free(buf_);
buf_size = BUFFER_INITIAL;
buf_ = (char *) malloc(buf_size);
if (!buf_) {
fprintf(stderr, "Error: Out of memory while allocating buffer!\n");
exit(1);
}
memset(buf_, 0, buf_size);
cur_ = 0;
}
void inline bufAppend(String str)
{
const char *s = str.c_str();
bufAppend(s);
}
void inline bufReset(void)
{
if (buf_) free(buf_);
buf_size = BUFFER_INITIAL;
buf_ = (char *) malloc(buf_size);
if (!buf_) {
fprintf(stderr, "Error: Out of memory while allocating buffer!\n");
exit(1);
}
memset(buf_, 0, buf_size);
cur_ = 0;
}
void inline resizeBuffer(void)
{
char *temp = (char *) malloc(buf_size);
if (!temp)
{
fprintf(stderr, "Error: Out of memory while attempting to grow buffer!\n");
exit(1);
}
if (buf_)
{
strcpy(temp, buf_);
free(buf_);
}
buf_ = temp;
}
void inline resizeBuffer(void)
{
char *temp = (char *) malloc(buf_size);
if (!temp)
{
fprintf(stderr, "Error: Out of memory while attempting to grow buffer!\n");
exit(1);
}
if (buf_)
{
strcpy(temp, buf_);
free(buf_);
}
buf_ = temp;
}
};
......
/*** BNFC-Generated Visitor Design Pattern Skeleton. ***/
/* This implements the common visitor design pattern.
Note that this method uses Visitor-traversal of lists, so
List->accept() does NOT traverse the list. This allows different
algorithms to use context information differently. */
Note that this method uses Visitor-traversal of lists, so
List->accept() does NOT traverse the list. This allows different
algorithms to use context information differently. */
#include "Skeleton.h"
......@@ -26,563 +26,563 @@ void Skeleton::visitRelOp(RelOp *t) {} //abstract class
void Skeleton::visitPIdent(PIdent *p_ident)
{
/* Code For PIdent Goes Here */
/* Code For PIdent Goes Here */
visitString(p_ident->string_);
visitInteger(p_ident->integer_);
visitString(p_ident->string_);
visitInteger(p_ident->integer_);
}
void Skeleton::visitProg(Prog *prog)
{
/* Code For Prog Goes Here */
/* Code For Prog Goes Here */
prog->listtopdef_->accept(this);
prog->listtopdef_->accept(this);
}
void Skeleton::visitFnDef(FnDef *fn_def)
{
/* Code For FnDef Goes Here */
/* Code For FnDef Goes Here */
fn_def->fundef_->accept(this);
fn_def->fundef_->accept(this);
}
void Skeleton::visitClDef(ClDef *cl_def)
{
/* Code For ClDef Goes Here */
/* Code For ClDef Goes Here */
cl_def->classdef_->accept(this);
cl_def->classdef_->accept(this);
}
void Skeleton::visitFuncDef(FuncDef *func_def)
{
/* Code For FuncDef Goes Here */
/* Code For FuncDef Goes Here */
func_def->type_->accept(this);
func_def->pident_->accept(this);
func_def->listarg_->accept(this);
func_def->block_->accept(this);
func_def->type_->accept(this);
func_def->pident_->accept(this);
func_def->listarg_->accept(this);
func_def->block_->accept(this);
}
void Skeleton::visitAr(Ar *ar)
{
/* Code For Ar Goes Here */
/* Code For Ar Goes Here */
ar->type_->accept(this);
ar->pident_->accept(this);
ar->type_->accept(this);
ar->pident_->accept(this);
}
void Skeleton::visitClassDefN(ClassDefN *class_def_n)
{
/* Code For ClassDefN Goes Here */
/* Code For ClassDefN Goes Here */
class_def_n->pident_->accept(this);
class_def_n->classblock_->accept(this);
class_def_n->pident_->accept(this);
class_def_n->classblock_->accept(this);
}
void Skeleton::visitClassDefE(ClassDefE *class_def_e)
{
/* Code For ClassDefE Goes Here */
/* Code For ClassDefE Goes Here */
class_def_e->pident_1->accept(this);
class_def_e->pident_2->accept(this);
class_def_e->classblock_->accept(this);
class_def_e->pident_1->accept(this);
class_def_e->pident_2->accept(this);
class_def_e->classblock_->accept(this);
}
void Skeleton::visitClassBl(ClassBl *class_bl)
{
/* Code For ClassBl Goes Here */
/* Code For ClassBl Goes Here */
class_bl->listclassblockdef_->accept(this);
class_bl->listclassblockdef_->accept(this);
}
void Skeleton::visitClassMthd(ClassMthd *class_mthd)
{
/* Code For ClassMthd Goes Here */
/* Code For ClassMthd Goes Here */
class_mthd->fundef_->accept(this);
class_mthd->fundef_->accept(this);
}
void Skeleton::visitClassFld(ClassFld *class_fld)
{
/* Code For ClassFld Goes Here */
/* Code For ClassFld Goes Here */
class_fld->type_->accept(this);
class_fld->listitem_->accept(this);
class_fld->type_->accept(this);
class_fld->listitem_->accept(this);
}
void Skeleton::visitBlk(Blk *blk)
{
/* Code For Blk Goes Here */
/* Code For Blk Goes Here */
blk->liststmt_->accept(this);
blk->liststmt_->accept(this);
}
void Skeleton::visitEmpty(Empty *empty)
{
/* Code For Empty Goes Here */
/* Code For Empty Goes Here */
}
void Skeleton::visitBStmt(BStmt *b_stmt)
{
/* Code For BStmt Goes Here */
/* Code For BStmt Goes Here */
b_stmt->block_->accept(this);
b_stmt->block_->accept(this);
}
void Skeleton::visitDecl(Decl *decl)
{
/* Code For Decl Goes Here */
/* Code For Decl Goes Here */
decl->type_->accept(this);
decl->listitem_->accept(this);
decl->type_->accept(this);
decl->listitem_->accept(this);
}
void Skeleton::visitAss(Ass *ass)
{
/* Code For Ass Goes Here */
/* Code For Ass Goes Here */
ass->expr_1->accept(this);
ass->expr_2->accept(this);
ass->expr_1->accept(this);
ass->expr_2->accept(this);
}
void Skeleton::visitTableAss(TableAss *table_ass)
{
/* Code For TableAss Goes Here */
/* Code For TableAss Goes Here */
table_ass->pident_->accept(this);
table_ass->expr_1->accept(this);
table_ass->expr_2->accept(this);
table_ass->pident_->accept(this);
table_ass->expr_1->accept(this);
table_ass->expr_2->accept(this);
}
void Skeleton::visitTableIncr(TableIncr *table_incr)
{
/* Code For TableIncr Goes Here */
/* Code For TableIncr Goes Here */
table_incr->pident_->accept(this);
table_incr->expr_->accept(this);
table_incr->pident_->accept(this);
table_incr->expr_->accept(this);
}
void Skeleton::visitTableDecr(TableDecr *table_decr)
{
/* Code For TableDecr Goes Here */
/* Code For TableDecr Goes Here */
table_decr->pident_->accept(this);
table_decr->expr_->accept(this);
table_decr->pident_->accept(this);
table_decr->expr_->accept(this);
}
void Skeleton::visitIncr(Incr *incr)
{
/* Code For Incr Goes Here */
/* Code For Incr Goes Here */
incr->pident_->accept(this);
incr->pident_->accept(this);
}
void Skeleton::visitDecr(Decr *decr)
{
/* Code For Decr Goes Here */
/* Code For Decr Goes Here */
decr->pident_->accept(this);
decr->pident_->accept(this);
}
void Skeleton::visitRet(Ret *ret)
{
/* Code For Ret Goes Here */
/* Code For Ret Goes Here */
ret->expr_->accept(this);
ret->expr_->accept(this);
}
void Skeleton::visitVRet(VRet *v_ret)
{
/* Code For VRet Goes Here */
/* Code For VRet Goes Here */
}
void Skeleton::visitCond(Cond *cond)
{
/* Code For Cond Goes Here */
/* Code For Cond Goes Here */
cond->expr_->accept(this);
cond->stmt_->accept(this);
cond->expr_->accept(this);
cond->stmt_->accept(this);
}
void Skeleton::visitCondElse(CondElse *cond_else)
{
/* Code For CondElse Goes Here */
/* Code For CondElse Goes Here */
cond_else->expr_->accept(this);
cond_else->stmt_1->accept(this);
cond_else->stmt_2->accept(this);
cond_else->expr_->accept(this);
cond_else->stmt_1->accept(this);
cond_else->stmt_2->accept(this);
}
void Skeleton::visitWhile(While *while_)
{
/* Code For While Goes Here */
/* Code For While Goes Here */
while_->expr_->accept(this);
while_->stmt_->accept(this);
while_->expr_->accept(this);
while_->stmt_->accept(this);
}
void Skeleton::visitSExp(SExp *s_exp)
{
/* Code For SExp Goes Here */
/* Code For SExp Goes Here */
s_exp->expr_->accept(this);
s_exp->expr_->accept(this);
}
void Skeleton::visitForEach(ForEach *for_each)
{
/* Code For ForEach Goes Here */
/* Code For ForEach Goes Here */
for_each->type_->accept(this);
for_each->pident_->accept(this);
for_each->expr_->accept(this);
for_each->stmt_->accept(this);
for_each->type_->accept(this);
for_each->pident_->accept(this);
for_each->expr_->accept(this);
for_each->stmt_->accept(this);
}
void Skeleton::visitNoInit(NoInit *no_init)
{
/* Code For NoInit Goes Here */
/* Code For NoInit Goes Here */
no_init->pident_->accept(this);
no_init->pident_->accept(this);
}
void Skeleton::visitInit(Init *init)
{
/* Code For Init Goes Here */
/* Code For Init Goes Here */
init->pident_->accept(this);
init->expr_->accept(this);
init->pident_->accept(this);
init->expr_->accept(this);
}
void Skeleton::visitInt(Int *int_)
{
/* Code For Int Goes Here */
/* Code For Int Goes Here */
}
void Skeleton::visitStr(Str *str)
{
/* Code For Str Goes Here */
/* Code For Str Goes Here */
}
void Skeleton::visitBool(Bool *bool_)
{
/* Code For Bool Goes Here */
/* Code For Bool Goes Here */
}
void Skeleton::visitVoid(Void *void_)
{
/* Code For Void Goes Here */
/* Code For Void Goes Here */
}
void Skeleton::visitArray(Array *array)
{
/* Code For Array Goes Here */
/* Code For Array Goes Here */
array->type_->accept(this);
array->type_->accept(this);
}
void Skeleton::visitClassT(ClassT *class_t)
{
/* Code For ClassT Goes Here */
/* Code For ClassT Goes Here */
class_t->pident_->accept(this);
class_t->pident_->accept(this);
}
void Skeleton::visitFun(Fun *fun)
{
/* Code For Fun Goes Here */
/* Code For Fun Goes Here */
fun->type_->accept(this);
fun->listtype_->accept(this);
fun->type_->accept(this);
fun->listtype_->accept(this);
}
void Skeleton::visitEVar(EVar *e_var)
{
/* Code For EVar Goes Here */
/* Code For EVar Goes Here */
e_var->pident_->accept(this);
e_var->pident_->accept(this);
}
void Skeleton::visitELitInt(ELitInt *e_lit_int)
{
/* Code For ELitInt Goes Here */
/* Code For ELitInt Goes Here */
visitInteger(e_lit_int->integer_);
visitInteger(e_lit_int->integer_);
}
void Skeleton::visitELitTrue(ELitTrue *e_lit_true)
{
/* Code For ELitTrue Goes Here */
/* Code For ELitTrue Goes Here */
}
void Skeleton::visitELitFalse(ELitFalse *e_lit_false)
{
/* Code For ELitFalse Goes Here */
/* Code For ELitFalse Goes Here */
}
void Skeleton::visitEApp(EApp *e_app)
{
/* Code For EApp Goes Here */
/* Code For EApp Goes Here */
e_app->pident_->accept(this);
e_app->listexpr_->accept(this);
e_app->pident_->accept(this);
e_app->listexpr_->accept(this);
}
void Skeleton::visitEString(EString *e_string)
{
/* Code For EString Goes Here */
/* Code For EString Goes Here */
visitString(e_string->string_);
visitString(e_string->string_);
}
void Skeleton::visitENewArray(ENewArray *e_new_array)
{
/* Code For ENewArray Goes Here */
/* Code For ENewArray Goes Here */
e_new_array->type_->accept(this);
e_new_array->expr_->accept(this);
e_new_array->type_->accept(this);
e_new_array->expr_->accept(this);
}
void Skeleton::visitENewClass(ENewClass *e_new_class)
{
/* Code For ENewClass Goes Here */
/* Code For ENewClass Goes Here */
e_new_class->pident_->accept(this);
e_new_class->pident_->accept(this);
}
void Skeleton::visitEClsMmbr(EClsMmbr *e_cls_mmbr)
{
/* Code For EClsMmbr Goes Here */
/* Code For EClsMmbr Goes Here */
e_cls_mmbr->expr_->accept(this);
e_cls_mmbr->pident_->accept(this);
e_cls_mmbr->expr_->accept(this);
e_cls_mmbr->pident_->accept(this);
}
void Skeleton::visitEClsMthd(EClsMthd *e_cls_mthd)
{
/* Code For EClsMthd Goes Here */
/* Code For EClsMthd Goes Here */
e_cls_mthd->expr_->accept(this);
e_cls_mthd->pident_->accept(this);
e_cls_mthd->listexpr_->accept(this);
e_cls_mthd->expr_->accept(this);
e_cls_mthd->pident_->accept(this);
e_cls_mthd->listexpr_->accept(this);
}
void Skeleton::visitNull(Null *null)
{
/* Code For Null Goes Here */
/* Code For Null Goes Here */
}
void Skeleton::visitEIndexAcc(EIndexAcc *e_index_acc)
{
/* Code For EIndexAcc Goes Here */
/* Code For EIndexAcc Goes Here */
e_index_acc->pident_->accept(this);
e_index_acc->expr_->accept(this);
e_index_acc->pident_->accept(this);
e_index_acc->expr_->accept(this);
}
void Skeleton::visitECast(ECast *e_cast)
{
/* Code For ECast Goes Here */
/* Code For ECast Goes Here */
e_cast->pident_->accept(this);
e_cast->expr_->accept(this);
e_cast->pident_->accept(this);
e_cast->expr_->accept(this);
}
void Skeleton::visitNeg(Neg *neg)
{
/* Code For Neg Goes Here */
/* Code For Neg Goes Here */
neg->expr_->accept(this);
neg->expr_->accept(this);
}
void Skeleton::visitNot(Not *not_)
{
/* Code For Not Goes Here */
/* Code For Not Goes Here */
not_->expr_->accept(this);
not_->expr_->accept(this);
}
void Skeleton::visitEMul(EMul *e_mul)
{
/* Code For EMul Goes Here */
/* Code For EMul Goes Here */
e_mul->expr_1->accept(this);
e_mul->mulop_->accept(this);
e_mul->expr_2->accept(this);
e_mul->expr_1->accept(this);
e_mul->mulop_->accept(this);
e_mul->expr_2->accept(this);
}
void Skeleton::visitEAdd(EAdd *e_add)
{
/* Code For EAdd Goes Here */
/* Code For EAdd Goes Here */
e_add->expr_1->accept(this);
e_add->addop_->accept(this);
e_add->expr_2->accept(this);
e_add->expr_1->accept(this);
e_add->addop_->accept(this);
e_add->expr_2->accept(this);
}
void Skeleton::visitERel(ERel *e_rel)
{
/* Code For ERel Goes Here */
/* Code For ERel Goes Here */
e_rel->expr_1->accept(this);
e_rel->relop_->accept(this);
e_rel->expr_2->accept(this);
e_rel->expr_1->accept(this);
e_rel->relop_->accept(this);
e_rel->expr_2->accept(this);
}
void Skeleton::visitEAnd(EAnd *e_and)
{
/* Code For EAnd Goes Here */
/* Code For EAnd Goes Here */
e_and->expr_1->accept(this);
e_and->expr_2->accept(this);
e_and->expr_1->accept(this);
e_and->expr_2->accept(this);
}
void Skeleton::visitEOr(EOr *e_or)
{
/* Code For EOr Goes Here */
/* Code For EOr Goes Here */
e_or->expr_1->accept(this);
e_or->expr_2->accept(this);
e_or->expr_1->accept(this);
e_or->expr_2->accept(this);
}
void Skeleton::visitPlus(Plus *plus)
{
/* Code For Plus Goes Here */
/* Code For Plus Goes Here */
}
void Skeleton::visitMinus(Minus *minus)
{
/* Code For Minus Goes Here */
/* Code For Minus Goes Here */
}
void Skeleton::visitTimes(Times *times)
{
/* Code For Times Goes Here */
/* Code For Times Goes Here */
}
void Skeleton::visitDiv(Div *div)
{
/* Code For Div Goes Here */
/* Code For Div Goes Here */
}
void Skeleton::visitMod(Mod *mod)
{
/* Code For Mod Goes Here */
/* Code For Mod Goes Here */
}
void Skeleton::visitLTH(LTH *lth)
{
/* Code For LTH Goes Here */
/* Code For LTH Goes Here */
}
void Skeleton::visitLE(LE *le)
{
/* Code For LE Goes Here */
/* Code For LE Goes Here */
}
void Skeleton::visitGTH(GTH *gth)
{
/* Code For GTH Goes Here */
/* Code For GTH Goes Here */
}
void Skeleton::visitGE(GE *ge)
{
/* Code For GE Goes Here */
/* Code For GE Goes Here */
}
void Skeleton::visitEQU(EQU *equ)
{
/* Code For EQU Goes Here */
/* Code For EQU Goes Here */
}
void Skeleton::visitNE(NE *ne)
{
/* Code For NE Goes Here */
/* Code For NE Goes Here */
}
......@@ -590,84 +590,84 @@ void Skeleton::visitNE(NE *ne)
void Skeleton::visitListTopDef(ListTopDef *list_top_def)
{
for (ListTopDef::iterator i = list_top_def->begin() ; i != list_top_def->end() ; ++i)
{
(*i)->accept(this);
}
for (ListTopDef::iterator i = list_top_def->begin() ; i != list_top_def->end() ; ++i)
{
(*i)->accept(this);
}
}
void Skeleton::visitListArg(ListArg *list_arg)
{
for (ListArg::iterator i = list_arg->begin() ; i != list_arg->end() ; ++i)
{
(*i)->accept(this);
}
for (ListArg::iterator i = list_arg->begin() ; i != list_arg->end() ; ++i)
{
(*i)->accept(this);
}
}
void Skeleton::visitListClassBlockDef(ListClassBlockDef *list_class_block_def)
{
for (ListClassBlockDef::iterator i = list_class_block_def->begin() ; i != list_class_block_def->end() ; ++i)
{
(*i)->accept(this);
}
for (ListClassBlockDef::iterator i = list_class_block_def->begin() ; i != list_class_block_def->end() ; ++i)
{
(*i)->accept(this);
}
}
void Skeleton::visitListStmt(ListStmt *list_stmt)
{
for (ListStmt::iterator i = list_stmt->begin() ; i != list_stmt->end() ; ++i)
{
(*i)->accept(this);
}
for (ListStmt::iterator i = list_stmt->begin() ; i != list_stmt->end() ; ++i)
{
(*i)->accept(this);
}
}
void Skeleton::visitListItem(ListItem *list_item)
{
for (ListItem::iterator i = list_item->begin() ; i != list_item->end() ; ++i)
{
(*i)->accept(this);
}
for (ListItem::iterator i = list_item->begin() ; i != list_item->end() ; ++i)
{
(*i)->accept(this);
}
}
void Skeleton::visitListType(ListType *list_type)
{
for (ListType::iterator i = list_type->begin() ; i != list_type->end() ; ++i)
{
(*i)->accept(this);
}
for (ListType::iterator i = list_type->begin() ; i != list_type->end() ; ++i)
{
(*i)->accept(this);
}
}
void Skeleton::visitListExpr(ListExpr *list_expr)
{
for (ListExpr::iterator i = list_expr->begin() ; i != list_expr->end() ; ++i)
{
(*i)->accept(this);
}
for (ListExpr::iterator i = list_expr->begin() ; i != list_expr->end() ; ++i)
{
(*i)->accept(this);
}
}
void Skeleton::visitInteger(Integer x)
{
/* Code for Integer Goes Here */
/* Code for Integer Goes Here */
}
void Skeleton::visitChar(Char x)
{
/* Code for Char Goes Here */
/* Code for Char Goes Here */
}
void Skeleton::visitDouble(Double x)
{
/* Code for Double Goes Here */
/* Code for Double Goes Here */
}
void Skeleton::visitString(String x)
{
/* Code for String Goes Here */
/* Code for String Goes Here */
}
void Skeleton::visitIdent(Ident x)
{
/* Code for Ident Goes Here */
/* Code for Ident Goes Here */
}
......
......@@ -8,102 +8,102 @@
class Skeleton : public Visitor
{
public:
void visitProgram(Program *p);
void visitTopDef(TopDef *p);
void visitFunDef(FunDef *p);
void visitArg(Arg *p);
void visitClassDef(ClassDef *p);
void visitClassBlock(ClassBlock *p);
void visitClassBlockDef(ClassBlockDef *p);
void visitBlock(Block *p);
void visitStmt(Stmt *p);
void visitItem(Item *p);
void visitType(Type *p);
void visitExpr(Expr *p);
void visitAddOp(AddOp *p);
void visitMulOp(MulOp *p);
void visitRelOp(RelOp *p);
void visitProg(Prog *p);
void visitFnDef(FnDef *p);
void visitClDef(ClDef *p);
void visitFuncDef(FuncDef *p);
void visitAr(Ar *p);
void visitClassDefN(ClassDefN *p);
void visitClassDefE(ClassDefE *p);
void visitClassBl(ClassBl *p);
void visitClassMthd(ClassMthd *p);
void visitClassFld(ClassFld *p);
void visitBlk(Blk *p);
void visitEmpty(Empty *p);
void visitBStmt(BStmt *p);
void visitDecl(Decl *p);
void visitNoInit(NoInit *p);
void visitInit(Init *p);
void visitAss(Ass *p);
void visitTableAss(TableAss *p);
void visitTableIncr(TableIncr *p);
void visitTableDecr(TableDecr *p);
void visitIncr(Incr *p);
void visitDecr(Decr *p);
void visitRet(Ret *p);
void visitVRet(VRet *p);
void visitCond(Cond *p);
void visitCondElse(CondElse *p);
void visitWhile(While *p);
void visitSExp(SExp *p);
void visitForEach(ForEach *p);
void visitInt(Int *p);
void visitStr(Str *p);
void visitBool(Bool *p);
void visitVoid(Void *p);
void visitArray(Array *p);
void visitClassT(ClassT *p);
void visitFun(Fun *p);
void visitEVar(EVar *p);
void visitELitInt(ELitInt *p);
void visitELitTrue(ELitTrue *p);
void visitELitFalse(ELitFalse *p);
void visitEApp(EApp *p);
void visitEString(EString *p);
void visitENewArray(ENewArray *p);
void visitENewClass(ENewClass *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEClsMthd(EClsMthd *p);
void visitNull(Null *p);
void visitEIndexAcc(EIndexAcc *p);
void visitECast(ECast *p);
void visitNeg(Neg *p);
void visitNot(Not *p);
void visitEMul(EMul *p);
void visitEAdd(EAdd *p);
void visitERel(ERel *p);
void visitEAnd(EAnd *p);
void visitEOr(EOr *p);
void visitPlus(Plus *p);
void visitMinus(Minus *p);
void visitTimes(Times *p);
void visitDiv(Div *p);
void visitMod(Mod *p);
void visitLTH(LTH *p);
void visitLE(LE *p);
void visitGTH(GTH *p);
void visitGE(GE *p);
void visitEQU(EQU *p);
void visitNE(NE *p);
void visitListTopDef(ListTopDef *p);
void visitListArg(ListArg *p);
void visitListClassBlockDef(ListClassBlockDef *p);
void visitListStmt(ListStmt *p);
void visitListItem(ListItem *p);
void visitListType(ListType *p);
void visitListExpr(ListExpr *p);
void visitPIdent(PIdent *p);
void visitProgram(Program *p);
void visitTopDef(TopDef *p);
void visitFunDef(FunDef *p);
void visitArg(Arg *p);
void visitClassDef(ClassDef *p);
void visitClassBlock(ClassBlock *p);
void visitClassBlockDef(ClassBlockDef *p);
void visitBlock(Block *p);
void visitStmt(Stmt *p);
void visitItem(Item *p);
void visitType(Type *p);
void visitExpr(Expr *p);
void visitAddOp(AddOp *p);
void visitMulOp(MulOp *p);
void visitRelOp(RelOp *p);
void visitProg(Prog *p);
void visitFnDef(FnDef *p);
void visitClDef(ClDef *p);
void visitFuncDef(FuncDef *p);
void visitAr(Ar *p);
void visitClassDefN(ClassDefN *p);
void visitClassDefE(ClassDefE *p);
void visitClassBl(ClassBl *p);
void visitClassMthd(ClassMthd *p);
void visitClassFld(ClassFld *p);
void visitBlk(Blk *p);
void visitEmpty(Empty *p);
void visitBStmt(BStmt *p);
void visitDecl(Decl *p);
void visitNoInit(NoInit *p);
void visitInit(Init *p);
void visitAss(Ass *p);
void visitTableAss(TableAss *p);
void visitTableIncr(TableIncr *p);
void visitTableDecr(TableDecr *p);
void visitIncr(Incr *p);
void visitDecr(Decr *p);
void visitRet(Ret *p);
void visitVRet(VRet *p);
void visitCond(Cond *p);
void visitCondElse(CondElse *p);
void visitWhile(While *p);
void visitSExp(SExp *p);
void visitForEach(ForEach *p);
void visitInt(Int *p);
void visitStr(Str *p);
void visitBool(Bool *p);
void visitVoid(Void *p);
void visitArray(Array *p);
void visitClassT(ClassT *p);
void visitFun(Fun *p);
void visitEVar(EVar *p);
void visitELitInt(ELitInt *p);
void visitELitTrue(ELitTrue *p);
void visitELitFalse(ELitFalse *p);
void visitEApp(EApp *p);
void visitEString(EString *p);
void visitENewArray(ENewArray *p);
void visitENewClass(ENewClass *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEClsMthd(EClsMthd *p);
void visitNull(Null *p);
void visitEIndexAcc(EIndexAcc *p);
void visitECast(ECast *p);
void visitNeg(Neg *p);
void visitNot(Not *p);
void visitEMul(EMul *p);
void visitEAdd(EAdd *p);
void visitERel(ERel *p);
void visitEAnd(EAnd *p);
void visitEOr(EOr *p);
void visitPlus(Plus *p);
void visitMinus(Minus *p);
void visitTimes(Times *p);
void visitDiv(Div *p);
void visitMod(Mod *p);
void visitLTH(LTH *p);
void visitLE(LE *p);
void visitGTH(GTH *p);
void visitGE(GE *p);
void visitEQU(EQU *p);
void visitNE(NE *p);
void visitListTopDef(ListTopDef *p);
void visitListArg(ListArg *p);
void visitListClassBlockDef(ListClassBlockDef *p);
void visitListStmt(ListStmt *p);
void visitListItem(ListItem *p);
void visitListType(ListType *p);
void visitListExpr(ListExpr *p);
void visitPIdent(PIdent *p);
void visitInteger(Integer x);
void visitChar(Char x);
void visitDouble(Double x);
void visitString(String x);
void visitIdent(Ident x);
void visitInteger(Integer x);
void visitChar(Char x);
void visitDouble(Double x);
void visitString(String x);
void visitIdent(Ident x);
};
......
......@@ -6,10 +6,10 @@ void TypeCheck::visitTopDef(TopDef *t) {} //abstract class
void TypeCheck::visitFunDef(FunDef *t) {} //abstract class
void TypeCheck::visitArg(Arg *t) {} //abstract class
void TypeCheck::visitClassDef(ClassDef *t) {
t->getName()->accept(this);
if (t->getParent())
t->getParent()->accept(this);
t->getBlock()->accept(this);
t->getName()->accept(this);
if (t->getParent())
t->getParent()->accept(this);
t->getBlock()->accept(this);
}
void TypeCheck::visitClassBlock(ClassBlock *t) {} //abstract class
......@@ -25,554 +25,554 @@ void TypeCheck::visitRelOp(RelOp *t) {} //abstract class
void TypeCheck::visitPIdent(PIdent *p_ident)
{
/* Code For PIdent Goes Here */
/* Code For PIdent Goes Here */
visitString(p_ident->string_);
visitInteger(p_ident->integer_);
visitString(p_ident->string_);
visitInteger(p_ident->integer_);
}
void TypeCheck::visitProg(Prog *prog)
{
/* Code For Prog Goes Here */
/* Code For Prog Goes Here */
prog->listtopdef_->accept(this);
prog->listtopdef_->accept(this);
}
void TypeCheck::visitFnDef(FnDef *fn_def)
{
/* Code For FnDef Goes Here */
/* Code For FnDef Goes Here */
fn_def->fundef_->accept(this);
fn_def->fundef_->accept(this);
}
void TypeCheck::visitClDef(ClDef *cl_def)
{
/* Code For ClDef Goes Here */
/* Code For ClDef Goes Here */
cl_def->classdef_->accept(this);
cl_def->classdef_->accept(this);
}
void TypeCheck::visitFuncDef(FuncDef *func_def)
{
/* Code For FuncDef Goes Here */
/* Code For FuncDef Goes Here */
func_def->type_->accept(this);
func_def->pident_->accept(this);
func_def->listarg_->accept(this);
func_def->block_->accept(this);
func_def->type_->accept(this);
func_def->pident_->accept(this);
func_def->listarg_->accept(this);
func_def->block_->accept(this);
}
void TypeCheck::visitAr(Ar *ar)
{
/* Code For Ar Goes Here */
/* Code For Ar Goes Here */
ar->type_->accept(this);
ar->pident_->accept(this);
ar->type_->accept(this);
ar->pident_->accept(this);
}
void TypeCheck::visitClassDefN(ClassDefN *class_def_n)
{
visitClassDef(class_def_n);
visitClassDef(class_def_n);
}
void TypeCheck::visitClassDefE(ClassDefE *class_def_e)
{
visitClassDef(class_def_e);
visitClassDef(class_def_e);
}
void TypeCheck::visitClassBl(ClassBl *class_bl)
{
/* Code For ClassBl Goes Here */
/* Code For ClassBl Goes Here */
class_bl->listclassblockdef_->accept(this);
class_bl->listclassblockdef_->accept(this);
}
void TypeCheck::visitClassMthd(ClassMthd *class_mthd)
{
/* Code For ClassMthd Goes Here */
/* Code For ClassMthd Goes Here */
class_mthd->fundef_->accept(this);
class_mthd->fundef_->accept(this);
}
void TypeCheck::visitClassFld(ClassFld *class_fld)
{
/* Code For ClassFld Goes Here */
/* Code For ClassFld Goes Here */
class_fld->type_->accept(this);
class_fld->listitem_->accept(this);
class_fld->type_->accept(this);
class_fld->listitem_->accept(this);
}
void TypeCheck::visitBlk(Blk *blk)
{
/* Code For Blk Goes Here */
/* Code For Blk Goes Here */
blk->liststmt_->accept(this);
blk->liststmt_->accept(this);
}
void TypeCheck::visitEmpty(Empty *empty)
{
/* Code For Empty Goes Here */
/* Code For Empty Goes Here */
}
void TypeCheck::visitBStmt(BStmt *b_stmt)
{
/* Code For BStmt Goes Here */
/* Code For BStmt Goes Here */
b_stmt->block_->accept(this);
b_stmt->block_->accept(this);
}
void TypeCheck::visitDecl(Decl *decl)
{
/* Code For Decl Goes Here */
/* Code For Decl Goes Here */
decl->type_->accept(this);
decl->listitem_->accept(this);
decl->type_->accept(this);
decl->listitem_->accept(this);
}
void TypeCheck::visitAss(Ass *ass)
{
/* Code For Ass Goes Here */
/* Code For Ass Goes Here */
ass->expr_1->accept(this);
ass->expr_2->accept(this);
ass->expr_1->accept(this);
ass->expr_2->accept(this);
}
void TypeCheck::visitTableAss(TableAss *table_ass)
{
/* Code For TableAss Goes Here */
/* Code For TableAss Goes Here */
table_ass->pident_->accept(this);
table_ass->expr_1->accept(this);
table_ass->expr_2->accept(this);
table_ass->pident_->accept(this);
table_ass->expr_1->accept(this);
table_ass->expr_2->accept(this);
}
void TypeCheck::visitTableIncr(TableIncr *table_incr)
{
/* Code For TableIncr Goes Here */
/* Code For TableIncr Goes Here */
table_incr->pident_->accept(this);
table_incr->expr_->accept(this);
table_incr->pident_->accept(this);
table_incr->expr_->accept(this);
}
void TypeCheck::visitTableDecr(TableDecr *table_decr)
{
/* Code For TableDecr Goes Here */
/* Code For TableDecr Goes Here */
table_decr->pident_->accept(this);
table_decr->expr_->accept(this);
table_decr->pident_->accept(this);
table_decr->expr_->accept(this);
}
void TypeCheck::visitIncr(Incr *incr)
{
/* Code For Incr Goes Here */
/* Code For Incr Goes Here */
incr->pident_->accept(this);
incr->pident_->accept(this);
}
void TypeCheck::visitDecr(Decr *decr)
{
/* Code For Decr Goes Here */
/* Code For Decr Goes Here */
decr->pident_->accept(this);
decr->pident_->accept(this);
}
void TypeCheck::visitRet(Ret *ret)
{
/* Code For Ret Goes Here */
/* Code For Ret Goes Here */
ret->expr_->accept(this);
ret->expr_->accept(this);
}
void TypeCheck::visitVRet(VRet *v_ret)
{
/* Code For VRet Goes Here */
/* Code For VRet Goes Here */
}
void TypeCheck::visitCond(Cond *cond)
{
/* Code For Cond Goes Here */
/* Code For Cond Goes Here */
cond->expr_->accept(this);
cond->stmt_->accept(this);
cond->expr_->accept(this);
cond->stmt_->accept(this);
}
void TypeCheck::visitCondElse(CondElse *cond_else)
{
/* Code For CondElse Goes Here */
/* Code For CondElse Goes Here */
cond_else->expr_->accept(this);
cond_else->stmt_1->accept(this);
cond_else->stmt_2->accept(this);
cond_else->expr_->accept(this);
cond_else->stmt_1->accept(this);
cond_else->stmt_2->accept(this);
}
void TypeCheck::visitWhile(While *while_)
{
/* Code For While Goes Here */
/* Code For While Goes Here */
while_->expr_->accept(this);
while_->stmt_->accept(this);
while_->expr_->accept(this);
while_->stmt_->accept(this);
}
void TypeCheck::visitSExp(SExp *s_exp)
{
/* Code For SExp Goes Here */
/* Code For SExp Goes Here */
s_exp->expr_->accept(this);
s_exp->expr_->accept(this);
}
void TypeCheck::visitForEach(ForEach *for_each)
{
/* Code For ForEach Goes Here */
/* Code For ForEach Goes Here */
for_each->type_->accept(this);
for_each->pident_->accept(this);
for_each->expr_->accept(this);
for_each->stmt_->accept(this);
for_each->type_->accept(this);
for_each->pident_->accept(this);
for_each->expr_->accept(this);
for_each->stmt_->accept(this);
}
void TypeCheck::visitNoInit(NoInit *no_init)
{
/* Code For NoInit Goes Here */
/* Code For NoInit Goes Here */
no_init->pident_->accept(this);
no_init->pident_->accept(this);
}
void TypeCheck::visitInit(Init *init)
{
/* Code For Init Goes Here */
/* Code For Init Goes Here */
init->pident_->accept(this);
init->expr_->accept(this);
init->pident_->accept(this);
init->expr_->accept(this);
}
void TypeCheck::visitInt(Int *int_)
{
/* Code For Int Goes Here */
/* Code For Int Goes Here */
}
void TypeCheck::visitStr(Str *str)
{
/* Code For Str Goes Here */
/* Code For Str Goes Here */
}
void TypeCheck::visitBool(Bool *bool_)
{
/* Code For Bool Goes Here */
/* Code For Bool Goes Here */
}
void TypeCheck::visitVoid(Void *void_)
{
/* Code For Void Goes Here */
/* Code For Void Goes Here */
}
void TypeCheck::visitArray(Array *array)
{
/* Code For Array Goes Here */
/* Code For Array Goes Here */
array->type_->accept(this);
array->type_->accept(this);
}
void TypeCheck::visitClassT(ClassT *class_t)
{
/* Code For ClassT Goes Here */
/* Code For ClassT Goes Here */
class_t->pident_->accept(this);
class_t->pident_->accept(this);
}
void TypeCheck::visitFun(Fun *fun)
{
/* Code For Fun Goes Here */
/* Code For Fun Goes Here */
fun->type_->accept(this);
fun->listtype_->accept(this);
fun->type_->accept(this);
fun->listtype_->accept(this);
}
void TypeCheck::visitEVar(EVar *e_var)
{
/* Code For EVar Goes Here */
/* Code For EVar Goes Here */
e_var->pident_->accept(this);
e_var->pident_->accept(this);
}
void TypeCheck::visitELitInt(ELitInt *e_lit_int)
{
/* Code For ELitInt Goes Here */
/* Code For ELitInt Goes Here */
visitInteger(e_lit_int->integer_);
visitInteger(e_lit_int->integer_);
}
void TypeCheck::visitELitTrue(ELitTrue *e_lit_true)
{
/* Code For ELitTrue Goes Here */
/* Code For ELitTrue Goes Here */
}
void TypeCheck::visitELitFalse(ELitFalse *e_lit_false)
{
/* Code For ELitFalse Goes Here */
/* Code For ELitFalse Goes Here */
}
void TypeCheck::visitEApp(EApp *e_app)
{
/* Code For EApp Goes Here */
/* Code For EApp Goes Here */
e_app->pident_->accept(this);
e_app->listexpr_->accept(this);
e_app->pident_->accept(this);
e_app->listexpr_->accept(this);
}
void TypeCheck::visitEString(EString *e_string)
{
/* Code For EString Goes Here */
/* Code For EString Goes Here */
visitString(e_string->string_);
visitString(e_string->string_);
}
void TypeCheck::visitENewArray(ENewArray *e_new_array)
{
/* Code For ENewArray Goes Here */
/* Code For ENewArray Goes Here */
e_new_array->type_->accept(this);
e_new_array->expr_->accept(this);
e_new_array->type_->accept(this);
e_new_array->expr_->accept(this);
}
void TypeCheck::visitENewClass(ENewClass *e_new_class)
{
/* Code For ENewClass Goes Here */
/* Code For ENewClass Goes Here */
e_new_class->pident_->accept(this);
e_new_class->pident_->accept(this);
}
void TypeCheck::visitEClsMmbr(EClsMmbr *e_cls_mmbr)
{
/* Code For EClsMmbr Goes Here */
/* Code For EClsMmbr Goes Here */
e_cls_mmbr->expr_->accept(this);
e_cls_mmbr->pident_->accept(this);
e_cls_mmbr->expr_->accept(this);
e_cls_mmbr->pident_->accept(this);
}
void TypeCheck::visitEClsMthd(EClsMthd *e_cls_mthd)
{
/* Code For EClsMthd Goes Here */
/* Code For EClsMthd Goes Here */
e_cls_mthd->expr_->accept(this);
e_cls_mthd->pident_->accept(this);
e_cls_mthd->listexpr_->accept(this);
e_cls_mthd->expr_->accept(this);
e_cls_mthd->pident_->accept(this);
e_cls_mthd->listexpr_->accept(this);
}
void TypeCheck::visitNull(Null *null)
{
/* Code For Null Goes Here */
/* Code For Null Goes Here */
}
void TypeCheck::visitEIndexAcc(EIndexAcc *e_index_acc)
{
/* Code For EIndexAcc Goes Here */
/* Code For EIndexAcc Goes Here */
e_index_acc->pident_->accept(this);
e_index_acc->expr_->accept(this);
e_index_acc->pident_->accept(this);
e_index_acc->expr_->accept(this);
}
void TypeCheck::visitECast(ECast *e_cast)
{
/* Code For ECast Goes Here */
/* Code For ECast Goes Here */
e_cast->pident_->accept(this);
e_cast->expr_->accept(this);
e_cast->pident_->accept(this);
e_cast->expr_->accept(this);
}
void TypeCheck::visitNeg(Neg *neg)
{
/* Code For Neg Goes Here */
/* Code For Neg Goes Here */
neg->expr_->accept(this);
neg->expr_->accept(this);
}
void TypeCheck::visitNot(Not *not_)
{
/* Code For Not Goes Here */
/* Code For Not Goes Here */
not_->expr_->accept(this);
not_->expr_->accept(this);
}
void TypeCheck::visitEMul(EMul *e_mul)
{
/* Code For EMul Goes Here */
/* Code For EMul Goes Here */
e_mul->expr_1->accept(this);
e_mul->mulop_->accept(this);
e_mul->expr_2->accept(this);
e_mul->expr_1->accept(this);
e_mul->mulop_->accept(this);
e_mul->expr_2->accept(this);
}
void TypeCheck::visitEAdd(EAdd *e_add)
{
/* Code For EAdd Goes Here */
/* Code For EAdd Goes Here */
e_add->expr_1->accept(this);
e_add->addop_->accept(this);
e_add->expr_2->accept(this);
e_add->expr_1->accept(this);
e_add->addop_->accept(this);
e_add->expr_2->accept(this);
}
void TypeCheck::visitERel(ERel *e_rel)
{
/* Code For ERel Goes Here */
/* Code For ERel Goes Here */
e_rel->expr_1->accept(this);
e_rel->relop_->accept(this);
e_rel->expr_2->accept(this);
e_rel->expr_1->accept(this);
e_rel->relop_->accept(this);
e_rel->expr_2->accept(this);
}
void TypeCheck::visitEAnd(EAnd *e_and)
{
/* Code For EAnd Goes Here */
/* Code For EAnd Goes Here */
e_and->expr_1->accept(this);
e_and->expr_2->accept(this);
e_and->expr_1->accept(this);
e_and->expr_2->accept(this);
}
void TypeCheck::visitEOr(EOr *e_or)
{
/* Code For EOr Goes Here */
/* Code For EOr Goes Here */
e_or->expr_1->accept(this);
e_or->expr_2->accept(this);
e_or->expr_1->accept(this);
e_or->expr_2->accept(this);
}
void TypeCheck::visitPlus(Plus *plus)
{
/* Code For Plus Goes Here */
/* Code For Plus Goes Here */
}
void TypeCheck::visitMinus(Minus *minus)
{
/* Code For Minus Goes Here */
/* Code For Minus Goes Here */
}
void TypeCheck::visitTimes(Times *times)
{
/* Code For Times Goes Here */
/* Code For Times Goes Here */
}
void TypeCheck::visitDiv(Div *div)
{
/* Code For Div Goes Here */
/* Code For Div Goes Here */
}
void TypeCheck::visitMod(Mod *mod)
{
/* Code For Mod Goes Here */
/* Code For Mod Goes Here */
}
void TypeCheck::visitLTH(LTH *lth)
{
/* Code For LTH Goes Here */
/* Code For LTH Goes Here */
}
void TypeCheck::visitLE(LE *le)
{
/* Code For LE Goes Here */
/* Code For LE Goes Here */
}
void TypeCheck::visitGTH(GTH *gth)
{
/* Code For GTH Goes Here */
/* Code For GTH Goes Here */
}
void TypeCheck::visitGE(GE *ge)
{
/* Code For GE Goes Here */
/* Code For GE Goes Here */
}
void TypeCheck::visitEQU(EQU *equ)
{
/* Code For EQU Goes Here */
/* Code For EQU Goes Here */
}
void TypeCheck::visitNE(NE *ne)
{
/* Code For NE Goes Here */
/* Code For NE Goes Here */
}
......@@ -580,84 +580,84 @@ void TypeCheck::visitNE(NE *ne)
void TypeCheck::visitListTopDef(ListTopDef *list_top_def)
{
for (ListTopDef::iterator i = list_top_def->begin() ; i != list_top_def->end() ; ++i)
{
(*i)->accept(this);
}
for (ListTopDef::iterator i = list_top_def->begin() ; i != list_top_def->end() ; ++i)
{
(*i)->accept(this);
}
}
void TypeCheck::visitListArg(ListArg *list_arg)
{
for (ListArg::iterator i = list_arg->begin() ; i != list_arg->end() ; ++i)
{
(*i)->accept(this);
}
for (ListArg::iterator i = list_arg->begin() ; i != list_arg->end() ; ++i)
{
(*i)->accept(this);
}
}
void TypeCheck::visitListClassBlockDef(ListClassBlockDef *list_class_block_def)
{
for (ListClassBlockDef::iterator i = list_class_block_def->begin() ; i != list_class_block_def->end() ; ++i)
{
(*i)->accept(this);
}
for (ListClassBlockDef::iterator i = list_class_block_def->begin() ; i != list_class_block_def->end() ; ++i)
{
(*i)->accept(this);
}
}
void TypeCheck::visitListStmt(ListStmt *list_stmt)
{
for (ListStmt::iterator i = list_stmt->begin() ; i != list_stmt->end() ; ++i)
{
(*i)->accept(this);
}
for (ListStmt::iterator i = list_stmt->begin() ; i != list_stmt->end() ; ++i)
{
(*i)->accept(this);
}
}
void TypeCheck::visitListItem(ListItem *list_item)
{
for (ListItem::iterator i = list_item->begin() ; i != list_item->end() ; ++i)
{
(*i)->accept(this);
}
for (ListItem::iterator i = list_item->begin() ; i != list_item->end() ; ++i)
{
(*i)->accept(this);
}
}
void TypeCheck::visitListType(ListType *list_type)
{
for (ListType::iterator i = list_type->begin() ; i != list_type->end() ; ++i)
{
(*i)->accept(this);
}
for (ListType::iterator i = list_type->begin() ; i != list_type->end() ; ++i)
{
(*i)->accept(this);
}
}
void TypeCheck::visitListExpr(ListExpr *list_expr)
{
for (ListExpr::iterator i = list_expr->begin() ; i != list_expr->end() ; ++i)
{
(*i)->accept(this);
}
for (ListExpr::iterator i = list_expr->begin() ; i != list_expr->end() ; ++i)
{
(*i)->accept(this);
}
}
void TypeCheck::visitInteger(Integer x)
{
/* Code for Integer Goes Here */
/* Code for Integer Goes Here */
}
void TypeCheck::visitChar(Char x)
{
/* Code for Char Goes Here */
/* Code for Char Goes Here */
}
void TypeCheck::visitDouble(Double x)
{
/* Code for Double Goes Here */
/* Code for Double Goes Here */
}
void TypeCheck::visitString(String x)
{
/* Code for String Goes Here */
/* Code for String Goes Here */
}
void TypeCheck::visitIdent(Ident x)
{
/* Code for Ident Goes Here */
/* Code for Ident Goes Here */
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment