2using System.Text.RegularExpressions;
62 M = this.
Matches(sl, sr, out
string[] GroupNames);
66 if (!(GroupNames is
null))
68 foreach (
string GroupName
in GroupNames)
70 Group G = M.Groups[GroupName];
73 string Value = G.Value;
87 if (this.partialMatch || (M.Index == 0 && M.Length == sl.Length))
103 lock (this.synchObject)
105 if (this.lastExpression is
null ||
Expression != this.lastExpression)
107 this.regex =
new Regex(
Expression, this.options);
112 foreach (
string s
in this.regex.GetGroupNames())
114 if (!
int.TryParse(s, out
int _))
124 this.groupNames =
null;
126 this.groupNames = Names.ToArray();
129 GroupNames = this.groupNames;
131 return this.regex.Match(Value);
135 private Regex regex =
null;
136 private string[] groupNames =
null;
137 private string lastExpression =
null;
138 private RegexOptions options = RegexOptions.Singleline;
139 private bool partialMatch =
false;
140 private readonly
object synchObject =
new object();
150 lock (this.synchObject)
152 this.options = value;
153 this.lastExpression =
null;
163 get => this.partialMatch;
164 set => this.partialMatch = value;
185 Match M = this.
Matches(sl, sr, out
string[] GroupNames);
189 if (!(GroupNames is
null))
191 foreach (
string GroupName
in GroupNames)
193 Group G = M.Groups[GroupName];
196 string Value = G.Value;
204 if (AlreadyFound.TryGetValue(GroupName, out
IElement E) &&
205 !E.AssociatedObjectValue.Equals(ObjValue))
A chunked list is a linked list of chunks of objects of type T .
Script runtime exception.
Class managing a script expression.
static IElement Encapsulate(object Value)
Encapsulates an object.
static bool TryParse(string s, out double Value)
Tries to parse a double-precision floating-point value.
ScriptNode right
Right operand.
ScriptNode left
Left operand.
Base class for binary scalar operators.
Represents a constant element value.
IElement Constant
Constant value.
Base class for all nodes in a parsed script tree.
int Length
Length of expression covered by node.
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.
static readonly BooleanValue False
Constant false value.
static readonly BooleanValue True
Constant true value.
RegexOptions Options
Options for regular expression. Default is RegexOptions.Singleline.
ExpressionTransform TransformExpression
Event raised before performing comparison. Can be used to transform expression.
bool PartialMatch
If a partial match is sufficient for operator to return true. (Default=false)
override PatternMatchResult PatternMatch(IElement CheckAgainst, Dictionary< string, IElement > AlreadyFound)
Performs a pattern match operation.
Match Matches(string Value, string Expression, out string[] GroupNames)
Checks a value against a regular expression.
override IElement EvaluateScalar(IElement Left, IElement Right, Variables Variables)
Evaluates the operator on scalar operands.
Like(ScriptNode Left, ScriptNode Right, int Start, int Length, Expression Expression)
Like
Basic interface for all types of elements.
object AssociatedObjectValue
Associated object value.
PatternMatchResult
Status result of a pattern matching operation.
delegate string ExpressionTransform(string Expression)
Delegate for expression transforms.