Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3743,7 +3743,8 @@ void EmitLazy(RegexNode node)
{
startingPos = ReserveName("lazyloop_starting_pos");
sawEmpty = ReserveName("lazyloop_empty_seen");
writer.WriteLine($"int {startingPos} = pos, {sawEmpty} = 0; // the lazy loop may match empty iterations");
additionalDeclarations.Add($"int {startingPos} = 0, {sawEmpty} = 0;");
writer.WriteLine($"{startingPos} = {sawEmpty} = 0; // the lazy loop may match empty iterations");
}

// If the min count is 0, start out by jumping right to what's after the loop. Backtracking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,14 @@ public static IEnumerable<object[]> Match_MemberData()
yield return (@"(abcd*?)+e", "abcde", RegexOptions.None, 0, 5, true, "abcde");
yield return (@"(abcd*)+?e", "abcde", RegexOptions.None, 0, 5, true, "abcde");
yield return (@"(abcd*?)+?e", "abcde", RegexOptions.None, 0, 5, true, "abcde");
yield return (@"(?:m(?:((e)?)??)|a)\b", "you m you", RegexOptions.None, 0, 9, true, "m");
yield return (@"(?:m(?:((e)?)??)|a)\b", "you me you", RegexOptions.None, 0, 10, true, "me");
yield return (@"(?:m(?:((e)?)??)|a)\b", "you a you", RegexOptions.None, 0, 9, true, "a");
yield return (@"(?:m(?:((e)?)??)|a)\b", "you and you", RegexOptions.None, 0, 11, false, "");
yield return (@"(?:m(?:|(e)?)|a)\b", "you m you", RegexOptions.None, 0, 9, true, "m");
yield return (@"(?:m(?:|(e)?)|a)\b", "you me you", RegexOptions.None, 0, 10, true, "me");
yield return (@"(?:m(?:|(e)?)|a)\b", "you a you", RegexOptions.None, 0, 9, true, "a");
yield return (@"(?:m(?:|(e)?)|a)\b", "you and you", RegexOptions.None, 0, 11, false, "");

// Testing selected FindOptimizations finds the right prefix
yield return (@"(^|a+)bc", " aabc", RegexOptions.None, 0, 5, true, "aabc");
Expand Down
Loading