This commit is contained in:
Youmu Liu
2026-09-23 18:19:33 +08:00
parent 7ddfc36ac5
commit 194e869724
4 changed files with 62 additions and 3 deletions
@@ -39,6 +39,8 @@ namespace Nitload.RegularAnalysis.Abstraction
public interface IMixEvaluator<TElement, TValue> public interface IMixEvaluator<TElement, TValue>
{ {
public Relation<TElement, TValue, IRelationEvaluator<TElement, TValue>>[] DownstreamPorts { get; }
TValue Evaluate( TValue Evaluate(
Span<Relation<TElement, TValue>> relations Span<Relation<TElement, TValue>> relations
); );
@@ -0,0 +1,25 @@
// -----------------------------------------------------------------------------
// file="PropertyEvaluator"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using Nitload.RegularAnalysis.Abstraction;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nitload.RegularAnalysis.PropertyRegex
{
internal abstract class PropertyEvaluator<T> : IRelationEvaluator<T, PropertyMatchState>
{
public abstract PropertyMatchState Evaluate(
ReadOnlySpan<T> sequence
);
}
}
@@ -0,0 +1,32 @@
// -----------------------------------------------------------------------------
// file="PropertyMatchEngine"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using Nitload.RegularAnalysis.Abstraction;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nitload.RegularAnalysis.PropertyRegex
{
public class PropertyMatchEngine<T>
{
private readonly List<Mix<T, PropertyMatchState>> _nodes = [];
private readonly List<Relation<T, PropertyMatchState, PropertyEvaluator<T>>> _relations = [];
}
public class FrozenPropertyMatchEngine<T>
{
private readonly Mix<T, PropertyMatchState>[] _nodes;
private readonly Relation<T, PropertyMatchState, PropertyEvaluator<T>>[] _relations;
}
}
@@ -1,5 +1,5 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// file="PropertyMatchEngine" // file="PropertyMatchState"
// Project: StgSharp // Project: StgSharp
// Copyright (c) Nitload. // Copyright (c) Nitload.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
@@ -11,7 +11,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Nitload.RegularAnalysis.AttributeRegex namespace Nitload.RegularAnalysis.PropertyRegex
{ {
internal class PropertyMatchEngine { } internal class PropertyMatchState { }
} }