Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Print.cs
1using System.Threading.Tasks;
5
7{
12 {
22 {
23 }
24
28 public override string FunctionName => nameof(Print);
29
36 {
37 IElement E = this.Argument.Evaluate(Variables);
38 string Msg = E.AssociatedObjectValue is string s ? s : Expression.ToString(E.AssociatedObjectValue);
39 Variables.ConsoleOut?.Write(Msg);
40 return E;
41 }
42
48 public override async Task<IElement> EvaluateAsync(Variables Variables)
49 {
50 IElement E = await this.Argument.EvaluateAsync(Variables);
51 string Msg = E.AssociatedObjectValue is string s ? s : Expression.ToString(E.AssociatedObjectValue);
52 Variables.ConsoleOut?.Write(Msg);
53 return E;
54 }
55
63 {
64 return Argument;
65 }
66 }
67}
Class managing a script expression.
Definition: Expression.cs:39
static string ToString(double Value)
Converts a value to a string, that can be parsed as part of an expression.
Definition: Expression.cs:4496
Prints to the console.
Definition: Print.cs:12
Print(ScriptNode Argument, int Start, int Length, Expression Expression)
Prints to the console.
Definition: Print.cs:20
override string FunctionName
Name of the function
Definition: Print.cs:28
override async Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
Definition: Print.cs:48
override IElement Evaluate(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
Definition: Print.cs:35
override IElement Evaluate(IElement Argument, Variables Variables)
Evaluates the function.
Definition: Print.cs:62
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
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 ...
Definition: ScriptNode.cs:158
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
object AssociatedObjectValue
Associated object value.
Definition: IElement.cs:33