Skip to content

Treat range quantifiers as literal if invalid #104

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
Jan 11, 2022

Conversation

hamishknight
Copy link
Contributor

This matches the PCRE and Oniguruma behavior. In addition, allow escaped quotes in experimental syntax, allowing for e.g "\"".

This matches the PCRE and Oniguruma behavior. Also
make sure the matching engine can handle a 0 range.
@hamishknight
Copy link
Contributor Author

@swift-ci please test Linux

@hamishknight hamishknight requested a review from milseman January 11, 2022 12:37
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

diagnose(#"\Qab\"#, expecting: .expected("\\E")) { _ = try $0.lexQuote() }
diagnose(#""ab"#, expecting: .expected("\""), .experimental) { _ = try $0.lexQuote() }
diagnose(#""ab\""#, expecting: .expected("\""), .experimental) { _ = try $0.lexQuote() }
diagnose(#""ab\"#, expecting: .unexpectedEndOfInput, .experimental) { _ = try $0.lexQuote() }
Copy link
Member

Choose a reason for hiding this comment

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

Nice, these kinds of tests are coming along nicely!

return .range(l, u)

case (nil, nil, _?):
fatalError("Didn't lex lower bound, but lexed upper bound?")
Copy link
Member

Choose a reason for hiding this comment

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

At some point, we should do a pass over the codebase and convert unreachable fatalErrors to unreachable throws, differentiating them from diagnostics.

@hamishknight hamishknight merged commit a2bacbe into swiftlang:main Jan 11, 2022
@hamishknight hamishknight deleted the dotting-and-crossing branch January 11, 2022 13:53
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