Skip to content

Commit

Permalink
refactor: rename binary expression to operator
Browse files Browse the repository at this point in the history
  • Loading branch information
midouest committed Feb 28, 2021
1 parent 9798f75 commit 33c2c67
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions include/expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ namespace bb
int c;
};

class BinaryExpression : public Expression
class BinaryOperator : public Expression
{
public:
explicit BinaryExpression(ExpressionPtr left, ExpressionPtr right) : left(move(left)), right(move(right)){};
explicit BinaryOperator(ExpressionPtr left, ExpressionPtr right) : left(move(left)), right(move(right)){};

string to_string() const
{
Expand All @@ -67,10 +67,10 @@ namespace bb
ExpressionPtr right;
};

class Add : public BinaryExpression
class Add : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -84,10 +84,10 @@ namespace bb
}
};

class Subtract : public BinaryExpression
class Subtract : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -101,10 +101,10 @@ namespace bb
}
};

class Multiply : public BinaryExpression
class Multiply : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -118,10 +118,10 @@ namespace bb
}
};

class Divide : public BinaryExpression
class Divide : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -141,10 +141,10 @@ namespace bb
}
};

class Modulo : public BinaryExpression
class Modulo : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -165,10 +165,10 @@ namespace bb
}
};

class BitwiseAnd : public BinaryExpression
class BitwiseAnd : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -182,10 +182,10 @@ namespace bb
}
};

class BitwiseOr : public BinaryExpression
class BitwiseOr : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -199,10 +199,10 @@ namespace bb
}
};

class BitwiseXor : public BinaryExpression
class BitwiseXor : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -216,10 +216,10 @@ namespace bb
}
};

class BitwiseShiftLeft : public BinaryExpression
class BitwiseShiftLeft : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -233,10 +233,10 @@ namespace bb
}
};

class BitwiseShiftRight : public BinaryExpression
class BitwiseShiftRight : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -250,10 +250,10 @@ namespace bb
}
};

class LessThan : public BinaryExpression
class LessThan : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -267,10 +267,10 @@ namespace bb
}
};

class GreaterThan : public BinaryExpression
class GreaterThan : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -284,10 +284,10 @@ namespace bb
}
};

class LessThanOrEqual : public BinaryExpression
class LessThanOrEqual : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -301,10 +301,10 @@ namespace bb
}
};

class GreaterThanOrEqual : public BinaryExpression
class GreaterThanOrEqual : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -318,10 +318,10 @@ namespace bb
}
};

class Equal : public BinaryExpression
class Equal : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand All @@ -335,10 +335,10 @@ namespace bb
}
};

class NotEqual : public BinaryExpression
class NotEqual : public BinaryOperator
{
public:
using BinaryExpression::BinaryExpression;
using BinaryOperator::BinaryOperator;

int evaluate(int t) const
{
Expand Down

0 comments on commit 33c2c67

Please sign in to comment.