regex interpreter now can build partial correct AST (i forget groups), but in bad shape. building an optimizer.
This commit is contained in:
@@ -29,6 +29,7 @@ using StgSharp.Collections;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Xml.Schema;
|
||||
|
||||
@@ -38,6 +39,8 @@ namespace StgSharp.RegularAnalysis.Abstraction
|
||||
where TType : unmanaged
|
||||
{
|
||||
|
||||
private HashSet<TNode> _allToken = new();
|
||||
|
||||
private TNode _root;
|
||||
|
||||
public int Count
|
||||
@@ -45,17 +48,31 @@ namespace StgSharp.RegularAnalysis.Abstraction
|
||||
get { return _allToken.Count; }
|
||||
}
|
||||
|
||||
public TNode Root => _root;
|
||||
public TNode Root
|
||||
{
|
||||
get;
|
||||
internal set
|
||||
{
|
||||
if (_allToken.Contains(value)) {
|
||||
field = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool AddNode(
|
||||
TNode node
|
||||
)
|
||||
{
|
||||
return _allToken.Add(node);
|
||||
}
|
||||
|
||||
public bool Contains(
|
||||
TNode node
|
||||
)
|
||||
{
|
||||
return _allToken<TLabel>.Contains(node);
|
||||
return _allToken.Contains(node);
|
||||
}
|
||||
|
||||
private List<TNode> _allToken<TLabel> =
|
||||
new();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user