Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Break.cs
1using System.Threading.Tasks;
6
8{
13 {
14 private readonly bool hasValue;
15
25 {
26 this.hasValue = false;
27 }
28
38 {
39 this.hasValue = true;
40 }
41
45 public override string FunctionName => nameof(Break);
46
53 {
54 if (this.hasValue)
55 return base.Evaluate(Variables);
56 else
57 {
58 //ScriptBreakLoopException.TryThrowReused();
59 throw new ScriptBreakLoopException();
60 }
61 }
62
68 public override Task<IElement> EvaluateAsync(Variables Variables)
69 {
70 if (this.hasValue)
71 return base.EvaluateAsync(Variables);
72 else
73 {
74 //ScriptBreakLoopException.TryThrowReused();
75 throw new ScriptBreakLoopException();
76 }
77 }
78
86 {
87 //ScriptBreakLoopException.TryThrowReused(Argument);
89 }
90 }
91}
Class managing a script expression.
Definition: Expression.cs:41
Breaks a loop, with or without providing a loop value.
Definition: Break.cs:13
Break(ScriptNode Argument, int Start, int Length, Expression Expression)
Breaks a loop, providing a loop value.
Definition: Break.cs:36
override string FunctionName
Name of the function
Definition: Break.cs:45
override IElement Evaluate(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
Definition: Break.cs:52
override Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
Definition: Break.cs:68
Break(int Start, int Length, Expression Expression)
Breaks a loop, without providing a loop value.
Definition: Break.cs:22
override IElement Evaluate(IElement Argument, Variables Variables)
Evaluates the function.
Definition: Break.cs:85
Represents a constant element value.
Base class for funcions of one variable.
ScriptNode Argument
Function argument.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:21