-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Update regex parsing to latest .Net core parsing (and diagnostic messages). #76269
Conversation
{ | ||
// bug with .NET regex parser. can happen with patterns like: (?(?S)) | ||
return treeAndText; | ||
} |
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.
workarounds for when we found regex strings that would crash .net :) these have been fixed in .net core, so we don't need this.
src/EditorFeatures/CSharpTest2/Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests.csproj
Outdated
Show resolved
Hide resolved
@@ -1093,14 +1064,14 @@ internal abstract class RegexConditionalGroupingNode : RegexQuestionGroupingNode | |||
{ | |||
protected RegexConditionalGroupingNode( | |||
RegexKind kind, RegexToken openParenToken, RegexToken questionToken, | |||
RegexExpressionNode result, RegexToken closeParenToken) | |||
RegexAlternationNode result, RegexToken closeParenToken) |
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.
made more strongly typed.
<PropertyGroup> | ||
<StartupObject /> | ||
<TargetFramework>net472</TargetFramework> | ||
<UseWpf>true</UseWpf> | ||
<TargetFrameworks>$(NetRoslyn)</TargetFrameworks> |
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.
Love to see this.
// From the .NET regex code: | ||
// This is code for Posix style properties - [:Ll:] or [:IsTibetan:]. | ||
// It currently doesn't do anything other than skip the whole thing! | ||
if (!afterRangeMinus && _currentToken.Kind == RegexKind.OpenBracketToken && _lexer.IsAt(":")) |
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.
rmoved in dotnet/runtime#88590
var optionsToken = _lexer.TryScanOptions(); | ||
if (optionsToken != null) | ||
// Corresponds to check at: https://github.com/dotnet/runtime/blob/7790117932dc14aaeb2fc82aff6c0dc6c74ce434/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs#L1003 | ||
if (!inConditionalExpression) |
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.
Changed in dotnet/corefx#16609
Fixes #61215