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>>) &&
37 (Right is IEnumerable<KeyValuePair<string, IElement>> ||
38 Right is IEnumerable<KeyValuePair<string, object>>))
40 return Grade.Excellent;
43 return Grade.NotAtAll;
54 Dictionary<string, IElement> Result =
new Dictionary<string, IElement>();
58 if (L is IDictionary<string, IElement> LeftDictionary)
60 foreach (KeyValuePair<string, IElement> P
in LeftDictionary)
61 Result[P.Key] = P.Value;
63 else if (L is IDictionary<string, object> LeftDictionary2)
65 foreach (KeyValuePair<string, object> P
in LeftDictionary2)
68 else if (L is IEnumerable<KeyValuePair<string, IElement>> LeftEnumeration)
70 foreach (KeyValuePair<string, IElement> P
in LeftEnumeration)
72 if (Result.TryGetValue(P.Key, out
IElement E))
75 Result[P.Key] = P.Value;
78 else if (L is IEnumerable<KeyValuePair<string, object>> LeftEnumeration2)
80 foreach (KeyValuePair<string, object> P
in LeftEnumeration2)
84 if (Result.TryGetValue(P.Key, out
IElement E))
87 Result[P.Key] = Value;
91 if (R is IDictionary<string, IElement> RightDictionary)
93 foreach (KeyValuePair<string, IElement> P
in RightDictionary)
95 if (Result.TryGetValue(P.Key, out
IElement E))
98 Result[P.Key] = P.Value;
101 else if (R is IDictionary<string, object> RightDictionary2)
103 foreach (KeyValuePair<string, object> P
in RightDictionary2)
107 if (Result.TryGetValue(P.Key, out
IElement E))
110 Result[P.Key] = Value;
113 else if (R is IEnumerable<KeyValuePair<string, IElement>> RightEnumeration)
115 foreach (KeyValuePair<string, IElement> P
in RightEnumeration)
117 if (Result.TryGetValue(P.Key, out
IElement E))
120 Result[P.Key] = P.Value;
123 else if (R is IEnumerable<KeyValuePair<string, object>> RightEnumeration2)
125 foreach (KeyValuePair<string, object> P
in RightEnumeration2)
129 if (Result.TryGetValue(P.Key, out
IElement E))
132 Result[P.Key] = Value;
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 two dictionaries.
DictionaryAddition()
Performs addition of two dictionaries.
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.
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.