meet difficult problem on COUNT node
This commit is contained in:
@@ -180,6 +180,50 @@ namespace Nitload.RegularAnalysis.Text
|
||||
|
||||
#endregion
|
||||
|
||||
#region CONCAT continuation
|
||||
|
||||
private static void AppendConcatNodes(
|
||||
RegexAstNode node,
|
||||
List<RegexAstNode> sequence
|
||||
)
|
||||
{
|
||||
if (RegexAstNode.IsNullOrEmpty(node)) {
|
||||
return;
|
||||
}
|
||||
if (node.Label == RegexElementLabel.CONCAT &&
|
||||
!RegexAstNode.IsDotStar(node.Left) && !IsNamedFind(node))
|
||||
{
|
||||
AppendConcatNodes(node.Left, sequence);
|
||||
AppendConcatNodes(node.Right, sequence);
|
||||
} else {
|
||||
sequence.Add(node);
|
||||
}
|
||||
}
|
||||
|
||||
private static void GenerateConcatTail(
|
||||
IReadOnlyList<RegexAstNode> sequence,
|
||||
int start,
|
||||
in SequenceEmitter<string> sc,
|
||||
in List<SequenceEmitter<string>> func_list,
|
||||
in SourceGenContext context,
|
||||
in ExitLabel exit_label
|
||||
)
|
||||
{
|
||||
for (int i = start; i < sequence.Count; i++)
|
||||
{
|
||||
RegexAstNode node = sequence[i];
|
||||
if (node.Label == RegexElementLabel.COUNT)
|
||||
{
|
||||
// COUNT owns both its repetition and the continuation that may retry it.
|
||||
GenerateCount(node, sc, func_list, context, exit_label, sequence, i + 1);
|
||||
return;
|
||||
}
|
||||
GenerateMethodSource(node, sc, func_list, context, exit_label);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FIND concatenation
|
||||
|
||||
private static bool TryGenerateFindConcat(
|
||||
|
||||
Reference in New Issue
Block a user