54 lines
891 B
C++
54 lines
891 B
C++
#pragma once
|
|
|
|
#include "../Expression.h"
|
|
|
|
namespace AST
|
|
{
|
|
|
|
class Binary : public Expression
|
|
{
|
|
|
|
public:
|
|
|
|
enum EBinaryType
|
|
{
|
|
// Arithmetic
|
|
ADDITION,
|
|
SUBTRACTION,
|
|
MULTIPLICATON,
|
|
DIVISION,
|
|
MODULO,
|
|
// Relational
|
|
EQ,
|
|
NEQ,
|
|
GT,
|
|
GEQ,
|
|
LT,
|
|
LEQ,
|
|
// Assignment
|
|
BASIC_ASSIGNMENT,
|
|
ADDITION_ASSIGNMENT,
|
|
SUBTRACTION_ASSIGNMENT,
|
|
MULTIPLICATION_ASSIGNMENT,
|
|
DIVISION_ASSIGNMENT,
|
|
MODULO_ASSIGNMENT,
|
|
};
|
|
|
|
explicit Binary (const Expression * pLeftExpr, const Expression * pRightExpr);
|
|
virtual ~Binary (void);
|
|
|
|
virtual EExpressionType getExpressionType (void) const { return(BINARY); }
|
|
|
|
const Expression * getLeftExpression() const { return(m_pLeftExpr); }
|
|
const Expression * getRightExpression() const { return(m_pRightExpr); }
|
|
|
|
virtual EBinaryType getBinaryType (void) const = 0;
|
|
|
|
private:
|
|
|
|
const Expression * m_pLeftExpr;
|
|
const Expression * m_pRightExpr;
|
|
};
|
|
|
|
}
|