Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ImplicitPrint.cs
1using System;
2using System.Threading.Tasks;
6
8{
13 {
14 private readonly string content;
15
24 : base(Start, Length, Expression)
25 {
26 this.content = Content;
27 }
28
32 public string Content => this.content;
33
38 public override bool IsAsynchronous => true;
39
46 {
47 return this.EvaluateAsync(Variables).Result;
48 }
49
55 public override async Task<IElement> EvaluateAsync(Variables Variables)
56 {
57 string s = await Expression.TransformAsync(this.content, "((", "))", Variables);
58 Variables.ConsoleOut?.Write(s);
59 return new StringValue(s);
60 }
61
63 public override bool Equals(object obj)
64 {
65 return obj is ImplicitPrint O &&
66 this.content.Equals(O.content) &&
67 base.Equals(obj);
68 }
69
71 public override int GetHashCode()
72 {
73 int Result = base.GetHashCode();
74 Result ^= Result << 5 ^ this.content.GetHashCode();
75 return Result;
76 }
77
78 }
79}
Class managing a script expression.
Definition: Expression.cs:39
static Task< string > TransformAsync(string s, string StartDelimiter, string StopDelimiter, Variables Variables)
Transforms a string by executing embedded script.
Definition: Expression.cs:4441
Base class for leaf nodes in a parsed script tree.
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Represents an implicit string to be printed.
override bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
ImplicitPrint(string Content, int Start, int Length, Expression Expression)
Represents an implicit string to be printed.
override bool Equals(object obj)
override async Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
override IElement Evaluate(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
Collection of variables.
Definition: Variables.cs:25
TextWriter ConsoleOut
Console out interface. Can be used by functions and script to output data to the console.
Definition: Variables.cs:219
Basic interface for all types of elements.
Definition: IElement.cs:20