-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add backtracking loops, backreferences, and if-then-else constructs to Regex "simplified" code gen #61906
Conversation
Tagging subscribers to this area: @eerhardt, @dotnet/area-system-text-regularexpressions |
src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs
Show resolved
Hide resolved
src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs
Show resolved
Hide resolved
src/libraries/System.Text.RegularExpressions/tests/Regex.KnownPattern.Tests.cs
Outdated
Show resolved
Hide resolved
@@ -74,6 +74,7 @@ internal abstract class RegexCompiler | |||
private static readonly MethodInfo s_stringIndexOfCharInt = typeof(string).GetMethod("IndexOf", new Type[] { typeof(char), typeof(int) })!; | |||
private static readonly MethodInfo s_stringLastIndexOfCharIntInt = typeof(string).GetMethod("LastIndexOf", new Type[] { typeof(char), typeof(int), typeof(int) })!; | |||
private static readonly MethodInfo s_textInfoToLowerMethod = typeof(TextInfo).GetMethod("ToLower", new Type[] { typeof(char) })!; | |||
private static readonly MethodInfo s_arrayResize = typeof(Array).GetMethod("Resize")!.MakeGenericMethod(typeof(int)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm interesting, I would have expected this to trigger a linker warning since the place using this is not annotated as RequiresUnreferencedCode cc: @eerhardt
Labels need to be followed by something other than a closing brace. Previously I was trying to opt labels in to emitting a semi-colon, but it's too error prone. Instead, we now by default emit a semicolon, and only skip it from call sites that opt-out because it's obvious they'll always be followed by code.
835a491
to
6809bb7
Compare
Contributes to #61902
Adds support to our "simplified" Regex codegen for backtracking loops, backreferences, and both if-then-else constructs.
cc: @joperezr