Skip to content

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

2 participants