29 if (Operation.
Name !=
"op_Addition")
30 return Grade.NotAtAll;
35 if ((Left is IEnumerable<KeyValuePair<string, IElement>> ||
36 Left is IEnumerable<KeyValuePair<string, object>>) &&
38 !(Right is IEnumerable<KeyValuePair<string, IElement>> ||
39 Right is IEnumerable<KeyValuePair<string, object>>))
41 return Grade.Excellent;
44 return Grade.NotAtAll;
55 Dictionary<string, IElement> Result =
new Dictionary<string, IElement>();
59 if (L is IDictionary<string, IElement> LeftDictionary)
61 foreach (KeyValuePair<string, IElement> P
in LeftDictionary)
64 else if (L is IDictionary<string, object> LeftDictionary2)
66 foreach (KeyValuePair<string, object> P
in LeftDictionary2)
69 else if (L is IEnumerable<KeyValuePair<string, IElement>> LeftEnumeration)
71 foreach (KeyValuePair<string, IElement> P
in LeftEnumeration)
73 if (Result.TryGetValue(P.Key, out
IElement E))
79 else if (L is IEnumerable<KeyValuePair<string, object>> LeftEnumeration2)
81 foreach (KeyValuePair<string, object> P
in LeftEnumeration2)
85 if (Result.TryGetValue(P.Key, out
IElement E))
Class managing a script expression.
static IElement Encapsulate(object Value)
Encapsulates an object.
Base class for all nodes in a parsed script tree.
static IElement EvaluateAddition(IElement Left, IElement Right, ScriptNode Node)
Adds two operands.
Performs addition of a dictionary and a scalar.
IElement Evaluate(IBinaryOperation Operation, ScriptNode Node)
Evaluates the custom binary operator.
Grade Supports(IBinaryOperation Operation)
How well the operator supports the given types of operands.
DictionaryRightScalarAddition()
Performs addition of a dictionary and a scalar.
Interface for binary operations.
string Name
Name of operator.
IElement Right
Right operand.
IElement Left
Left operand.
Interface for custom binary operators.
Basic interface for all types of elements.
object AssociatedObjectValue
Associated object value.
bool IsScalar
If the element represents a scalar value.