binOp
This commit is contained in:
26
inc/AST/BinOp.h
Normal file
26
inc/AST/BinOp.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef BINOP_H
|
||||
#define BINOP_H
|
||||
|
||||
#include <string>
|
||||
#include "AST/Expression.h"
|
||||
|
||||
class BinOp : public Expression {
|
||||
public:
|
||||
BinOp(Expression* leftExp ,std::string op, Expression* rightExp);
|
||||
virtual ~BinOp();
|
||||
|
||||
std::string getOp();
|
||||
Expression* getLeftExp();
|
||||
Expression* getRightExp();
|
||||
virtual void accept(ASTVisitor* visitor);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
std::string op_;
|
||||
Expression* leftExp_;
|
||||
Expression* rightExp_;
|
||||
|
||||
};
|
||||
|
||||
#endif // BINOP_H
|
||||
26
src/AST/BinOp.cpp
Normal file
26
src/AST/BinOp.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "AST/BinOp.h"
|
||||
#include "AST/ASTVisitor.h"
|
||||
|
||||
BinOp::BinOp(Expression *leftExp, std::string op, Expression *rightExp) :
|
||||
leftExp_(leftExp), op_(op), rightExp_(rightExp) {
|
||||
}
|
||||
|
||||
BinOp::~BinOp() {
|
||||
//
|
||||
}
|
||||
|
||||
std::string BinOp::getOp() {
|
||||
return op_;
|
||||
}
|
||||
|
||||
Expression* BinOp::getLeftExp() {
|
||||
return leftExp_;
|
||||
}
|
||||
|
||||
Expression* BinOp::getRightExp() {
|
||||
return rightExp_;
|
||||
}
|
||||
|
||||
void BinOp::accept(ASTVisitor* visitor) {
|
||||
visitor->visit(this);
|
||||
}
|
||||
Reference in New Issue
Block a user