before merge
This commit is contained in:
@@ -28,16 +28,14 @@
|
||||
using StgSharp.RegularAnalysis.Abstraction;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace StgSharp.RegularAnalysis.TextRegex
|
||||
namespace StgSharp.RegularAnalysis.Text
|
||||
{
|
||||
internal class RegexAstNode : ISyntaxNode<RegexAstNode, RegexElementLabel>
|
||||
{
|
||||
|
||||
// private RegexAstNode _left, _right;
|
||||
|
||||
public RegexAstNode(
|
||||
Token<RegexElementLabel> source
|
||||
)
|
||||
public RegexAstNode(Token<RegexElementLabel> source)
|
||||
{
|
||||
Source = source;
|
||||
}
|
||||
@@ -89,19 +87,14 @@ namespace StgSharp.RegularAnalysis.TextRegex
|
||||
|
||||
public Token<RegexElementLabel> Source { get; private protected set; }
|
||||
|
||||
public void AppendNode(
|
||||
RegexAstNode nextToken
|
||||
)
|
||||
public void AppendNode(RegexAstNode nextToken)
|
||||
{
|
||||
Next = nextToken;
|
||||
nextToken.Previous = this;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static (bool Valid, int Value) ComparePrecedence(
|
||||
RegexElementLabel left,
|
||||
RegexElementLabel right
|
||||
)
|
||||
public static (bool Valid, int Value) ComparePrecedence(RegexElementLabel left, RegexElementLabel right)
|
||||
{
|
||||
left &= RegexElementLabel.OPERATOR;
|
||||
right &= RegexElementLabel.OPERATOR;
|
||||
@@ -113,25 +106,19 @@ namespace StgSharp.RegularAnalysis.TextRegex
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool IsNullOrEmpty(
|
||||
RegexAstNode node
|
||||
)
|
||||
public static bool IsNullOrEmpty(RegexAstNode node)
|
||||
{
|
||||
return node is null || ReferenceEquals(node, Empty);
|
||||
}
|
||||
/**/
|
||||
|
||||
public void PrependNode(
|
||||
RegexAstNode previousNode
|
||||
)
|
||||
public void PrependNode(RegexAstNode previousNode)
|
||||
{
|
||||
Previous = previousNode;
|
||||
previousNode.Next = this;
|
||||
}
|
||||
|
||||
public void RemoveChild(
|
||||
RegexAstNode node
|
||||
)
|
||||
public void RemoveChild(RegexAstNode node)
|
||||
{
|
||||
if (Left == node)
|
||||
{
|
||||
@@ -149,9 +136,7 @@ namespace StgSharp.RegularAnalysis.TextRegex
|
||||
return new EmptyRegexAstNode();
|
||||
}
|
||||
|
||||
internal void RemoveAndAsChild(
|
||||
bool useLeft
|
||||
)
|
||||
internal void RemoveAndAsChild(bool useLeft)
|
||||
{
|
||||
if (useLeft)
|
||||
{
|
||||
@@ -176,9 +161,7 @@ namespace StgSharp.RegularAnalysis.TextRegex
|
||||
/// <param name="node">
|
||||
/// The node to replace the current node with.
|
||||
/// </param>
|
||||
internal void ReplaceBy(
|
||||
RegexAstNode node
|
||||
)
|
||||
internal void ReplaceBy(RegexAstNode node)
|
||||
{
|
||||
Source = node.Source;
|
||||
Left = node.Left;
|
||||
|
||||
Reference in New Issue
Block a user