Skip to content

Allow scoped removal of extended syntax in multi-line literals #484

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

Merged
merged 4 commits into from
Jun 17, 2022

Conversation

hamishknight
Copy link
Contributor

@hamishknight hamishknight commented Jun 15, 2022

Relax the ban on unsetting extended syntax in a multi-line literal such that it does not apply to a scoped unset e.g (?-x:...), as long as it does not span multiple lines.

This PR also bans the use of (?^) in a multi-line literal, unless it is scoped and does not span multiple lines. Instead, (?^x) must be written, as PCRE defines (?^) to be equivalent to (?-imnsx).

@hamishknight hamishknight requested a review from milseman June 15, 2022 11:20
This shouldn't include e.g `namedCapturesOnly`.
This should always be set in a multi-line literal,
with extended syntax potentially being set and
unset as we parse.
Relax the ban on unsetting extended syntax in a
multi-line literal such that it does not apply to
a scoped unset e.g `(?-x:...)`, as long as it does
not span multiple lines.

This commit also bans the use of `(?^)` in a
multi-line literal, unless it is scoped and does
not span multiple lines. Instead, `(?^x)` must be
written, as PCRE defines `(?^)` to be equivalent to
`(?-imnsx)`.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

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

LGTM

@hamishknight hamishknight merged commit 3076eba into swiftlang:main Jun 17, 2022
@hamishknight hamishknight deleted the limited-run-syntax branch June 17, 2022 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants