1using System.Collections.Generic;
2using System.Threading.Tasks;
13 private readonly LinkedList<ScriptNode> statements;
27 this.statements?.SetParent(
this);
32 private void CalcIsAsync()
36 foreach (
ScriptNode Statement
in this.statements)
50 public LinkedList<ScriptNode>
Statements => this.statements;
100 LinkedListNode<ScriptNode> Loop;
104 Loop = this.statements.First;
106 while (!(Loop is
null))
108 if (!(Loop.Value?.ForAllChildNodes(Callback, State, Order) ??
true))
115 Loop = this.statements.First;
116 bool RecalcIsAsync =
false;
118 while (!(Loop is
null))
123 bool Result = Callback(Node, out
ScriptNode NewNode, State);
124 if (!(NewNode is
null))
126 Loop.Value = NewNode;
127 NewNode.SetParent(
this);
130 RecalcIsAsync =
true;
150 Loop = this.statements.First;
152 while (!(Loop is
null))
154 if (!(Loop.Value?.ForAllChildNodes(Callback, State, Order) ??
true))
168 AreEqual(this.statements, O.statements) &&
175 int Result = base.GetHashCode();
176 Result ^= Result << 5 ^
GetHashCode(this.statements);
Class managing a script expression.
Base class for all nodes in a parsed script tree.
bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, bool DepthFirst)
Calls the callback method for all child nodes.
int Length
Length of expression covered by node.
static bool AreEqual(ScriptNode S1, ScriptNode S2)
Compares if two script nodes are equal.
int Start
Start position in script expression.
abstract IElement Evaluate(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection. This method should be ...
virtual Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection. This method should be ...
Represents a sequence of statements.
override bool Equals(object obj)
override IElement Evaluate(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
override bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
override bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, SearchMethod Order)
Calls the callback method for all child nodes.
Sequence(LinkedList< ScriptNode > Statements, int Start, int Length, Expression Expression)
Represents a sequence of statements.
override int GetHashCode()
override async Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
LinkedList< ScriptNode > Statements
Statements
Basic interface for all types of elements.
delegate bool ScriptNodeEventHandler(ScriptNode Node, out ScriptNode NewNode, object State)
Delegate for ScriptNode callback methods.
SearchMethod
Method to traverse the expression structure