1using System.Collections.Generic;
81 get {
return new string[] {
"Hour",
"Minute",
"Second" }; }
96 object Obj =
Arguments[0].AssociatedObjectValue;
98 if (Obj is System.DateTime TP)
100 else if (Obj is System.DateTimeOffset TPO)
105 string s = Obj?.
ToString() ??
string.Empty;
107 if (
TryParse(s, out System.TimeSpan TS))
113 double[] d =
new double[c];
116 for (i = 0; i < c; i++)
128 return new ObjectValue(
new System.TimeSpan((
int)d[0], (
int)d[1], (
int)d[2]));
131 return new ObjectValue(
new System.TimeSpan((
int)d[0], (
int)d[1], (
int)d[2], (
int)d[3]));
134 return new ObjectValue(
new System.TimeSpan((
int)d[0], (
int)d[1], (
int)d[2], (
int)d[3], (
int)d[4]));
147 public static bool TryParse(
string s, out System.TimeSpan TS)
163 else if (s[0] ==
'-')
169 if (!
DateTime.TryParseInt(s, ref Pos,
'.', out
int Days, out _) || Days < System.TimeSpan.MinValue.Days || Days > System.TimeSpan.MaxValue.Days)
173 TS =
new System.TimeSpan(Days, 0, 0, 0);
179 if (!
DateTime.TryParseInt(s, ref Pos,
':', out
int Hour, out _) || Hour < 0 || Hour > 23)
186 TS =
new System.TimeSpan(Days,
Hour, 0, 0);
192 if (!
DateTime.TryParseInt(s, ref Pos,
':', out
int Minute, out _) || Minute < 0 || Minute > 59)
199 TS =
new System.TimeSpan(Days,
Hour,
Minute, 0);
205 if (!
DateTime.TryParseInt(s, ref Pos,
'.', out
int Second, out _) || Second < 0 || Second > 59)
218 if (!
DateTime.TryParseInt(s, ref Pos,
'\x0', out
int MilliSecond, out
int NrDigits) || Pos < c)
252 if (!(Obj is System.TimeSpan TS))
255 TS =
new System.TimeSpan((
long)d);
260 if (!System.TimeSpan.TryParse(s, out TS))
262 if (
long.
TryParse(s, out
long Ticks))
263 TS =
new System.TimeSpan(Ticks);
Script runtime exception.
Class managing a script expression.
Creates a DateTime value.
Creates a TimeSpan value.
TimeSpan(ScriptNode String, int Start, int Length, Expression Expression)
Creates a TimeSpan value.
TimeSpan(ScriptNode Days, ScriptNode Hours, ScriptNode Minutes, ScriptNode Seconds, ScriptNode MSeconds, int Start, int Length, Expression Expression)
Creates a TimeSpan value.
override string[] DefaultArgumentNames
Default Argument names
TimeSpan(ScriptNode Hours, ScriptNode Minutes, ScriptNode Seconds, int Start, int Length, Expression Expression)
Creates a TimeSpan value.
TimeSpan(ScriptNode Days, ScriptNode Hours, ScriptNode Minutes, ScriptNode Seconds, int Start, int Length, Expression Expression)
Creates a TimeSpan value.
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
override string FunctionName
Name of the function
static bool TryParse(string s, out System.TimeSpan TS)
Parses TimeSpan values from short forms of strings.
override PatternMatchResult PatternMatch(IElement CheckAgainst, Dictionary< string, IElement > AlreadyFound)
Performs a pattern match operation.
Base class for multivariate funcions.
static readonly ArgumentType[] argumentTypes5Scalar
Five scalar parameters.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes3Scalar
Three scalar parameters.
static readonly ArgumentType[] argumentTypes1Scalar
One scalar parameter.
static readonly ArgumentType[] argumentTypes4Scalar
Four scalar parameters.
Base class for all nodes in a parsed script tree.
int Length
Length of expression covered by node.
override string ToString()
virtual PatternMatchResult PatternMatch(IElement CheckAgainst, Dictionary< string, IElement > AlreadyFound)
Performs a pattern match operation.
Expression Expression
Expression of which the node is a part.
int Start
Start position in script expression.
double Value
Double value.
Basic interface for all types of elements.
object AssociatedObjectValue
Associated object value.
PatternMatchResult
Status result of a pattern matching operation.