-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Regex if-then-else code generation (#63427)
* Fix Regex if-then-else code generation Code coverage revealed some gaps in testing around conditionals, which in turn led to discovering a) some bugs in both RegexCompiler and the source generator around expression conditionals, and b) divergence between the compiler and the source generator. This adds tests to address the code coverage gaps and fixes the implementations to both address the bugs and bring the code much closer. The main problem with expressional conditionals was flawed handling of backtracking, either not pushing the right state on to the stack or not initializing the state correctly in the first place. We also failed to revert positional changes made in the expression condition when the condition failed to match. * Address PR feedback * A few more tweaks
- Loading branch information
1 parent
7242690
commit 9d5cfc5
Showing
9 changed files
with
542 additions
and
364 deletions.
There are no files selected for viewing
266 changes: 153 additions & 113 deletions
266
src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs
Large diffs are not rendered by default.
Oops, something went wrong.
483 changes: 281 additions & 202 deletions
483
...raries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters