Skip to content

[5.7][SwiftSyntax] Parse regex literals using a fallback lexer implemented in C++ #58998

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

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented May 20, 2022

@ahoppen ahoppen requested a review from a team as a code owner May 20, 2022 10:57
@ahoppen ahoppen added the r5.7 label May 20, 2022
… in C++

`libInternalSwiftSyntaxParser.dylib` currently doesn’t link against `SwiftExperimentalStringProcessing`, so it can’t use the regex lexing functions defined within. This caused SwiftSyntax to fail if the source code contained regex literals.

Implement a fallback regex lexing function in C++ and use it for SwiftSyntax parsing.

rdar://93580240

Co-authored-by: Rintaro Ishizaki <[email protected]>
@ahoppen ahoppen force-pushed the pr-5.7/regex-literal-parsing-swiftsyntax branch from 00aff1b to 719ea8c Compare May 20, 2022 17:48
@ahoppen
Copy link
Member Author

ahoppen commented May 20, 2022

@swift-ci Please test

@ahoppen ahoppen requested a review from airspeedswift May 23, 2022 16:42
…ed at the end of the file

Fixes a SwiftSyntax parsing assertion failure if there is a regex literal at the end of the file. I.e. either a single line regex literal in a file without a trailing newline or a multi-line regex literal.

This does not crash in non-assert builds.
@ahoppen
Copy link
Member Author

ahoppen commented May 25, 2022

@swift-ci Please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants