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

Implement StringLiteralExprSyntax/contentValue. #2

Closed
wants to merge 1 commit into from

Conversation

NikolaiRuhe
Copy link
Owner

SwiftSyntax parses string literals as StringLiteralExprSyntax. When the literal is static (does not contain interpolation segments) it can be useful to access the actual string value from the syntax tree.

The source-accurate representation in StringLiteralExprSyntax differs from run-time value:

  • Escaped character sequences (\n, \u{1F600}) are not evaluated.
  • Some strings are split into segments (i.e. multiline strings).

StringLiteralExprSyntax/contentValue performs the necessary unescaping and concatenation of segments.

@NikolaiRuhe NikolaiRuhe closed this Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant