regex interpreter now can build partial correct AST (i forget groups), but in bad shape. building an optimizer.

This commit is contained in:
Youmu Liu
2026-02-06 17:07:03 +08:00
parent 1bfb8b67c4
commit 3a441b270c
13 changed files with 236 additions and 31 deletions
@@ -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();
}
}