fix errors in interpreter. add a enumerator for tree. working on tree optimizer

This commit is contained in:
Youmu Liu
2026-02-09 18:08:49 +08:00
parent 909bf50b9d
commit 807658111c
10 changed files with 288 additions and 106 deletions
+10 -4
View File
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="TestRegexAnalyse"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -38,11 +38,17 @@ namespace StgSharp
public class TestRegexAnalyse
{
private const string regex = @"abc(?<name>abc)";
private const string regex = @"ab[1-9]+(?<name>abc)";
public static void Run()
{
RegexInterpreter interpreter = RegexInterpreter.Analyze(regex);
AbstractSyntaxTree<RegexAstNode, RegexElementLabel> tree = interpreter.Tree;
Console.WriteLine();
Console.WriteLine();
foreach (RegexAstNode node in tree) {
Console.WriteLine($"{node.Source.Value}\t{node.Source.Flag}");
}
}
}