Base class of all operators (+,- etc) and a global lookup for finding an operator instance from its text. When the system starts, all operators are automatically discovered by looking for any Operator classes. You can essentially create your own by simply deriving the Operator class.
Public Member Functions | |
Operator (string pattern, int priority) | |
Creates a new operator with the given text and priority. More... | |
Operation | ToOperation (CompiledFragment left, CompiledFragment right, CompiledMethod method) |
Converts the the given fragments into a compiled operation by first checking the fragments are ok for this operator. More... | |
Static Public Member Functions | |
static void | Add (Operator newOperator) |
Adds a useable operator to the global lookup. More... | |
static bool | IsOperator (char character) |
Is the given character an operator or the start of one? More... | |
Public Attributes | |
int | Priority |
The priority of this operator over others. Essentially implements bodmas. More... | |
bool | LeftOnly |
True if this operator only uses the content to its left. e.g. LEFT++. More... | |
bool | RightOnly |
True if this operator only uses the content to its right. e.g. !RIGHT. More... | |
string | Pattern |
The operator text pattern, for example '+' More... | |
bool | LeftAndRight =true |
True if this operator uses the content on both the left and right of it. e.g. LEFT+RIGHT. More... | |
Static Public Attributes | |
static Dictionary< char, int > | Starts =new Dictionary<char,int>() |
The first character of an operator (as some have 2 or more; e.g. +=, &&) More... | |
static Dictionary< string, Operator > | FullOperators =new Dictionary<string,Operator>() |
A lookup for an operators text to the operator instance. e.g. '+' to the add operator. More... | |
Protected Member Functions | |
virtual Operation | Compile (CompiledFragment left, CompiledFragment right, CompiledMethod method) |
Converts the given fragments into a compiled operation. Overidden by the actual operators. More... | |
|
inline |
Creates a new operator with the given text and priority.
pattern | The operators text, such as "+" or "++". |
priority | The priority over other operators. The higher this value, the |
|
inlinestatic |
Adds a useable operator to the global lookup.
newOperator | The operator to add. |
|
inlineprotectedvirtual |
Converts the given fragments into a compiled operation. Overidden by the actual operators.
left | The fragment to the left of the operator. |
right | The fragment to the right of the operation. |
method | The method the operation will be compiled into. |
Reimplemented in Nitro.OperatorDecrement, Nitro.OperatorIncrement, Nitro.OperatorNot, Nitro.OperatorSubtract, Nitro.OperatorAdd, Nitro.OperatorAddTo, Nitro.OperatorBitwiseAnd, Nitro.OperatorBitwiseOr, Nitro.OperatorBitwiseXOr, Nitro.OperatorDivide, Nitro.OperatorDivideInTo, Nitro.OperatorGreaterThan, Nitro.OperatorGreaterThanOrEql, Nitro.OperatorLessThan, Nitro.OperatorLessThanOrEql, Nitro.OperatorLogicAnd, Nitro.OperatorLogicEql, Nitro.OperatorLogicNotEql, Nitro.OperatorLogicOr, Nitro.OperatorLShift, Nitro.OperatorModulo, Nitro.OperatorMultiply, Nitro.OperatorMultiplyInTo, Nitro.OperatorRShift, Nitro.OperatorSet, and Nitro.OperatorSubtractFrom.
|
inlinestatic |
Is the given character an operator or the start of one?
|
inline |
Converts the the given fragments into a compiled operation by first checking the fragments are ok for this operator.
left | The fragment to the left of the operator. |
right | The fragment to the right of the operation. |
method | The method the operation will be compiled into. |
A lookup for an operators text to the operator instance. e.g. '+' to the add operator.
bool Nitro.Operator.LeftAndRight =true |
True if this operator uses the content on both the left and right of it. e.g. LEFT+RIGHT.
bool Nitro.Operator.LeftOnly |
True if this operator only uses the content to its left. e.g. LEFT++.
string Nitro.Operator.Pattern |
The operator text pattern, for example '+'
int Nitro.Operator.Priority |
The priority of this operator over others. Essentially implements bodmas.
bool Nitro.Operator.RightOnly |
True if this operator only uses the content to its right. e.g. !RIGHT.
|
static |
The first character of an operator (as some have 2 or more; e.g. +=, &&)