Skip to content

Commit 111b16d

Browse files
authored
Merge pull request #2530 from rintaro/astgen-stringliteral
[Parser] Expose StringSegmentSyntax.appendUnescapedLiteralValue() as SPI
2 parents bdc3df2 + 983ce71 commit 111b16d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Sources/SwiftParser/Lexer/Cursor.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ extension SyntaxText {
3232
}
3333
}
3434

35-
enum StringLiteralKind: Equatable {
35+
@_spi(Compiler)
36+
public enum StringLiteralKind: Equatable {
3637
/// A normal single-line string literal started by `"`.
3738
case singleLine
3839
/// A multi-line string literal started by `"""`.

Sources/SwiftParser/StringLiteralRepresentedLiteralValue.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ extension StringLiteralExprSyntax {
4545
return result
4646
}
4747

48-
fileprivate var stringLiteralKind: StringLiteralKind? {
48+
@_spi(Compiler)
49+
public var stringLiteralKind: StringLiteralKind? {
4950
switch openingQuote.tokenKind {
5051
case .stringQuote:
5152
return .singleLine
@@ -58,13 +59,15 @@ extension StringLiteralExprSyntax {
5859
}
5960
}
6061

61-
fileprivate var delimiterLength: Int {
62+
@_spi(Compiler)
63+
public var delimiterLength: Int {
6264
openingPounds?.text.count ?? 0
6365
}
6466
}
6567

6668
extension StringSegmentSyntax {
67-
fileprivate func appendUnescapedLiteralValue(
69+
@_spi(Compiler)
70+
public func appendUnescapedLiteralValue(
6871
stringLiteralKind: StringLiteralKind,
6972
delimiterLength: Int,
7073
to output: inout String

0 commit comments

Comments
 (0)