Skip to content
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

Merged
merged 37 commits into from
Jan 17, 2025

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Dec 4, 2024

Fixes #61215

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 4, 2024
{
// bug with .NET regex parser. can happen with patterns like: (?(?S))
return treeAndText;
}
Copy link
Member Author

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.

@@ -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)
Copy link
Member Author

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>
Copy link
Member

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(":"))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member Author

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

@CyrusNajmabadi CyrusNajmabadi changed the title Update regex messages Update regex parsing to latest .Net core parsing (and diagnostic messages). Jan 16, 2025
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review January 16, 2025 22:59
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner January 16, 2025 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Regex subsystem error messages to match changes in .net's error messages
3 participants