Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PrintLine.cs
1using System.Threading.Tasks;
5
7{
12 {
22 {
23 }
24
32 : base(new ConstantElement(new StringValue(string.Empty), Start, Length, Expression),
34 {
35 }
36
40 public override string FunctionName => nameof(PrintLine);
41
45 public override string[] Aliases
46 {
47 get { return new string[] { "println" }; }
48 }
49
56 {
57 IElement E = this.Argument.Evaluate(Variables);
58 string Msg = E.AssociatedObjectValue is string s ? s : E.ToString();
59 Variables.ConsoleOut?.WriteLine(Msg);
60 return E;
61 }
62
68 public override async Task<IElement> EvaluateAsync(Variables Variables)
69 {
70 IElement E = await this.Argument.EvaluateAsync(Variables);
71 string Msg = E.AssociatedObjectValue is string s ? s : E.ToString();
72 Variables.ConsoleOut?.WriteLine(Msg);
73 return E;
74 }
75
83 {
84 return ObjectValue.Null;
85 }
86 }
87}
Class managing a script expression.
Definition: Expression.cs:41
Prints to the console, ending with a new line.
Definition: PrintLine.cs:12
override async Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
Definition: PrintLine.cs:68
override string FunctionName
Name of the function
Definition: PrintLine.cs:40
PrintLine(ScriptNode Argument, int Start, int Length, Expression Expression)
Prints to the console, ending with a new line.
Definition: PrintLine.cs:20
override IElement Evaluate(IElement Argument, Variables Variables)
Evaluates the function.
Definition: PrintLine.cs:82
override string[] Aliases
Optional aliases. If there are no aliases for the function, null is returned.
Definition: PrintLine.cs:46
PrintLine(int Start, int Length, Expression Expression)
Prints to the console, ending with a new line.
Definition: PrintLine.cs:31
override IElement Evaluate(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
Definition: PrintLine.cs:55
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
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
static readonly ObjectValue Null
Null value.
Definition: ObjectValue.cs:88
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:223
Basic interface for all types of elements.
Definition: IElement.cs:21