00001 #ifndef IDENTIFIER_H 00002 #define IDENTIFIER_H 00003 #include "ast.h" 00004 #include <string> 00005 #include "leftside.h" 00006 #include "expression.h" 00007 00008 using namespace std; 00009 00010 class Identifier : public Expression, public LeftSide { 00011 private: 00012 string name; 00013 public: 00014 Identifier(SrcPosition *position, string name) : Expression(position), LeftSide(position), Ast(position), name(name) {} 00015 Identifier(const Identifier& identifier) : Expression(identifier.position), LeftSide(identifier.position), Ast(position) { 00016 *(this) = identifier; 00017 } 00018 00019 virtual ~Identifier() {} 00020 00021 string getName() const { 00022 return this->name; 00023 } 00024 00025 virtual Ast& operator = (const Ast& ast); 00026 virtual bool operator == (const Ast& ast) const; 00027 00028 virtual VisitorReturn *visit(Visitor& visitor) { 00029 return visitor.visitIdentifier(this); 00030 } 00031 00032 virtual Ast& clone() const { 00033 return *(new Identifier(this->position, this->name)); 00034 } 00035 }; 00036 00037 #endif