#include <operators.h>
Public Types | |
enum | OpKind { __NO_OP__, __FIRST_OP__, __COMPARISON_START__ = __FIRST_OP__, LESS_THAN_OP = __COMPARISON_START__, LESS_OR_EQUAL_OP, NOT_EQUAL_OP, EQUAL_OP, GREATER_OR_EQUAL_OP, GREATER_THAN_OP, META_EQUAL_OP, IS_OP = META_EQUAL_OP, META_NOT_EQUAL_OP, ISNT_OP = META_NOT_EQUAL_OP, __COMPARISON_END__ = ISNT_OP, __ARITHMETIC_START__, UNARY_PLUS_OP = __ARITHMETIC_START__, UNARY_MINUS_OP, ADDITION_OP, SUBTRACTION_OP, MULTIPLICATION_OP, DIVISION_OP, MODULUS_OP, __ARITHMETIC_END__ = MODULUS_OP, __LOGIC_START__, LOGICAL_NOT_OP = __LOGIC_START__, LOGICAL_OR_OP, LOGICAL_AND_OP, __LOGIC_END__ = LOGICAL_AND_OP, __BITWISE_START__, BITWISE_NOT_OP = __BITWISE_START__, BITWISE_OR_OP, BITWISE_XOR_OP, BITWISE_AND_OP, LEFT_SHIFT_OP, RIGHT_SHIFT_OP, URIGHT_SHIFT_OP, __BITWISE_END__ = URIGHT_SHIFT_OP, __MISC_START__, PARENTHESES_OP = __MISC_START__, SUBSCRIPT_OP, TERNARY_OP, __MISC_END__ = TERNARY_OP, __LAST_OP__ = __MISC_END__, __NO_OP__, __FIRST_OP__, __COMPARISON_START__ = __FIRST_OP__, LESS_THAN_OP = __COMPARISON_START__, LESS_OR_EQUAL_OP, NOT_EQUAL_OP, EQUAL_OP, GREATER_OR_EQUAL_OP, GREATER_THAN_OP, META_EQUAL_OP, IS_OP = META_EQUAL_OP, META_NOT_EQUAL_OP, ISNT_OP = META_NOT_EQUAL_OP, __COMPARISON_END__ = ISNT_OP, __ARITHMETIC_START__, UNARY_PLUS_OP = __ARITHMETIC_START__, UNARY_MINUS_OP, ADDITION_OP, SUBTRACTION_OP, MULTIPLICATION_OP, DIVISION_OP, MODULUS_OP, __ARITHMETIC_END__ = MODULUS_OP, __LOGIC_START__, LOGICAL_NOT_OP = __LOGIC_START__, LOGICAL_OR_OP, LOGICAL_AND_OP, __LOGIC_END__ = LOGICAL_AND_OP, __BITWISE_START__, BITWISE_NOT_OP = __BITWISE_START__, BITWISE_OR_OP, BITWISE_XOR_OP, BITWISE_AND_OP, LEFT_SHIFT_OP, RIGHT_SHIFT_OP, URIGHT_SHIFT_OP, __BITWISE_END__ = URIGHT_SHIFT_OP, __MISC_START__, PARENTHESES_OP = __MISC_START__, SUBSCRIPT_OP, TERNARY_OP, __MISC_END__ = TERNARY_OP, __LAST_OP__ = __MISC_END__ } |
List of supported operators. More... | |
enum | OpKind { __NO_OP__, __FIRST_OP__, __COMPARISON_START__ = __FIRST_OP__, LESS_THAN_OP = __COMPARISON_START__, LESS_OR_EQUAL_OP, NOT_EQUAL_OP, EQUAL_OP, GREATER_OR_EQUAL_OP, GREATER_THAN_OP, META_EQUAL_OP, IS_OP = META_EQUAL_OP, META_NOT_EQUAL_OP, ISNT_OP = META_NOT_EQUAL_OP, __COMPARISON_END__ = ISNT_OP, __ARITHMETIC_START__, UNARY_PLUS_OP = __ARITHMETIC_START__, UNARY_MINUS_OP, ADDITION_OP, SUBTRACTION_OP, MULTIPLICATION_OP, DIVISION_OP, MODULUS_OP, __ARITHMETIC_END__ = MODULUS_OP, __LOGIC_START__, LOGICAL_NOT_OP = __LOGIC_START__, LOGICAL_OR_OP, LOGICAL_AND_OP, __LOGIC_END__ = LOGICAL_AND_OP, __BITWISE_START__, BITWISE_NOT_OP = __BITWISE_START__, BITWISE_OR_OP, BITWISE_XOR_OP, BITWISE_AND_OP, LEFT_SHIFT_OP, RIGHT_SHIFT_OP, URIGHT_SHIFT_OP, __BITWISE_END__ = URIGHT_SHIFT_OP, __MISC_START__, PARENTHESES_OP = __MISC_START__, SUBSCRIPT_OP, TERNARY_OP, __MISC_END__ = TERNARY_OP, __LAST_OP__ = __MISC_END__, __NO_OP__, __FIRST_OP__, __COMPARISON_START__ = __FIRST_OP__, LESS_THAN_OP = __COMPARISON_START__, LESS_OR_EQUAL_OP, NOT_EQUAL_OP, EQUAL_OP, GREATER_OR_EQUAL_OP, GREATER_THAN_OP, META_EQUAL_OP, IS_OP = META_EQUAL_OP, META_NOT_EQUAL_OP, ISNT_OP = META_NOT_EQUAL_OP, __COMPARISON_END__ = ISNT_OP, __ARITHMETIC_START__, UNARY_PLUS_OP = __ARITHMETIC_START__, UNARY_MINUS_OP, ADDITION_OP, SUBTRACTION_OP, MULTIPLICATION_OP, DIVISION_OP, MODULUS_OP, __ARITHMETIC_END__ = MODULUS_OP, __LOGIC_START__, LOGICAL_NOT_OP = __LOGIC_START__, LOGICAL_OR_OP, LOGICAL_AND_OP, __LOGIC_END__ = LOGICAL_AND_OP, __BITWISE_START__, BITWISE_NOT_OP = __BITWISE_START__, BITWISE_OR_OP, BITWISE_XOR_OP, BITWISE_AND_OP, LEFT_SHIFT_OP, RIGHT_SHIFT_OP, URIGHT_SHIFT_OP, __BITWISE_END__ = URIGHT_SHIFT_OP, __MISC_START__, PARENTHESES_OP = __MISC_START__, SUBSCRIPT_OP, TERNARY_OP, __MISC_END__ = TERNARY_OP, __LAST_OP__ = __MISC_END__ } |
List of supported operators. More... | |
Strict comparison operators | |
Non-strict comparison operators | |
Arithmetic operators | |
Logical operators | |
Bitwise operators | |
Miscellaneous operators | |
Public Member Functions | |
Operation (const Operation &op) | |
Copy Constructor. | |
virtual | ~Operation () |
Destructor. | |
Operation & | operator= (const Operation &op) |
Assignment operator. | |
void | GetComponents (OpKind &, ExprTree *&, ExprTree *&, ExprTree *&) const |
virtual ExprTree * | Copy () const |
Make a deep copy of the expression. | |
bool | CopyFrom (const Operation &op) |
virtual bool | SameAs (const ExprTree *tree) const |
Operation (const Operation &op) | |
Copy Constructor. | |
virtual | ~Operation () |
Destructor. | |
Operation & | operator= (const Operation &op) |
Assignment operator. | |
void | GetComponents (OpKind &, ExprTree *&, ExprTree *&, ExprTree *&) const |
virtual ExprTree * | Copy () const |
Make a deep copy of the expression. | |
bool | CopyFrom (const Operation &op) |
virtual bool | SameAs (const ExprTree *tree) const |
Static Public Member Functions | |
static Operation * | MakeOperation (OpKind kind, ExprTree *e1=NULL, ExprTree *e2=NULL, ExprTree *e3=NULL) |
static void | Operate (OpKind op, Value &op1, Value &op2, Value &result) |
static void | Operate (OpKind op, Value &op1, Value &op2, Value &op3, Value &result) |
static bool | IsStrictOperator (OpKind) |
static int | PrecedenceLevel (OpKind) |
static Operation * | MakeOperation (OpKind kind, ExprTree *e1=NULL, ExprTree *e2=NULL, ExprTree *e3=NULL) |
static void | Operate (OpKind op, Value &op1, Value &op2, Value &result) |
static void | Operate (OpKind op, Value &op1, Value &op2, Value &op3, Value &result) |
static bool | IsStrictOperator (OpKind) |
static int | PrecedenceLevel (OpKind) |
Protected Member Functions | |
Operation () | |
Constructor. | |
Operation () | |
Constructor. | |
Friends | |
bool | operator== (const Operation &op1, const Operation &op2) |
bool | operator== (const Operation &op1, const Operation &op2) |
Represents a node of the expression tree which is an operation applied to expression operands, like 3 + 2
enum Operation::OpKind |
List of supported operators.
enum Operation::OpKind |
List of supported operators.
Deconstructor to obtain the components of an operation node
kind | The kind of operation. | |
e1 | The first sub-expression child of the node. | |
e2 | The second sub-expression child of the node (if any). | |
e3 | The third sub-expression child of the node (if any). |
Deconstructor to obtain the components of an operation node
kind | The kind of operation. | |
e1 | The first sub-expression child of the node. | |
e2 | The second sub-expression child of the node (if any). | |
e3 | The third sub-expression child of the node (if any). |
static bool Operation::IsStrictOperator | ( | OpKind | ) | [static] |
Predicate which tests if an operator is strict.
op | The operator to be tested. |
bool Operation::IsStrictOperator | ( | OpKind | op | ) | [static] |
Predicate which tests if an operator is strict.
op | The operator to be tested. |
static Operation* Operation::MakeOperation | ( | OpKind | kind, | |
ExprTree * | e1 = NULL , |
|||
ExprTree * | e2 = NULL , |
|||
ExprTree * | e3 = NULL | |||
) | [static] |
Factory method to create an operation expression node
kind | The kind of operation. | |
e1 | The first sub-expression child of the node. | |
e2 | The second sub-expression child of the node (if any). | |
e3 | The third sub-expression child of the node (if any). |
Operation * Operation::MakeOperation | ( | OpKind | kind, | |
ExprTree * | e1 = NULL , |
|||
ExprTree * | e2 = NULL , |
|||
ExprTree * | e3 = NULL | |||
) | [static] |
Factory method to create an operation expression node
kind | The kind of operation. | |
e1 | The first sub-expression child of the node. | |
e2 | The second sub-expression child of the node (if any). | |
e3 | The third sub-expression child of the node (if any). |
int Operation::PrecedenceLevel | ( | OpKind | op | ) | [static] |
Gets the precedence level of an operator. Higher precedences get higher values. (See K&R, p.53)
op | The operator to get the precedence of |
static int Operation::PrecedenceLevel | ( | OpKind | ) | [static] |
Gets the precedence level of an operator. Higher precedences get higher values. (See K&R, p.53)
op | The operator to get the precedence of |
virtual bool Operation::SameAs | ( | const ExprTree * | tree | ) | const [virtual] |
bool Operation::SameAs | ( | const ExprTree * | tree | ) | const [virtual] |