Skip to content

Commit ff15c8f

Browse files
committed
Move SyntaxExpressibleByStringInterpolation to SwiftSyntaxBuilder
1 parent 62217b0 commit ff15c8f

File tree

8 files changed

+12
-26
lines changed

8 files changed

+12
-26
lines changed

Sources/SwiftParser/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ add_library(SwiftParser STATIC
2323
RawTokenKindSubset.swift
2424
Recovery.swift
2525
Statements.swift
26-
Syntax+StringInterpolation.swift
2726
TokenConsumer.swift
2827
TokenPrecedence.swift
2928
TopLevel.swift

Sources/SwiftParser/Parser.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ public struct Parser: TokenConsumer {
138138
/// arena is created automatically, and `input` copied into the
139139
/// arena. If non-`nil`, `input` must be the registered source
140140
/// buffer of `arena` or a slice of the source buffer.
141-
@_spi(Testing)
142141
public init(_ input: UnsafeBufferPointer<UInt8>, arena: SyntaxArena? = nil) {
143142
var sourceBuffer: UnsafeBufferPointer<UInt8>
144143
if let arena = arena {

Sources/SwiftParser/Patterns.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ extension Parser {
4444
/// as-pattern → pattern 'as' type
4545
///
4646
/// expression-pattern → expression
47-
mutating func parsePattern() -> RawPatternSyntax {
47+
@_spi(RawSyntax)
48+
public mutating func parsePattern() -> RawPatternSyntax {
4849
enum ExpectedTokens: RawTokenKindSubset {
4950
case leftParen
5051
case wildcardKeyword

Sources/SwiftSyntaxBuilder/ParserIntegration.swift

Lines changed: 0 additions & 23 deletions
This file was deleted.

Sources/SwiftParser/Syntax+StringInterpolation.swift renamed to Sources/SwiftSyntaxBuilder/Syntax+StringInterpolation.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@_spi(RawSyntax)
22
import SwiftSyntax
3+
import SwiftParser
34

45
fileprivate class Indenter: SyntaxRewriter {
56
let indentation: Trivia
@@ -112,6 +113,12 @@ extension SyntaxStringInterpolation: StringInterpolationProtocol {
112113
sourceText.append(contentsOf: value.description.utf8)
113114
self.lastIndentation = nil
114115
}
116+
117+
public mutating func appendInterpolation<Buildable: SyntaxBuildable>(
118+
_ buildable: Buildable
119+
) {
120+
self.appendInterpolation(buildable.buildSyntax())
121+
}
115122
}
116123

117124
/// Syntax nodes that can be formed by a string interpolation involve source

Sources/SwiftParser/SyntaxExpressilbeByStringInterpolationConformances.swift.gyb renamed to Sources/SwiftSyntaxBuilder/SyntaxExpressibleByStringInterpolationConformances.swift.gyb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
//===----------------------------------------------------------------------===//
2020

2121
@_spi(RawSyntax) import SwiftSyntax
22+
@_spi(RawSyntax) import SwiftParser
2223

2324
% STRING_INTERPOLATION_BASE_KINDS = [base_kind for base_kind in SYNTAX_BASE_KINDS if base_kind != 'Syntax' and base_kind != 'SyntaxCollection']
2425
% for base_kind in STRING_INTERPOLATION_BASE_KINDS:

Sources/SwiftParser/gyb_generated/SyntaxExpressilbeByStringInterpolationConformances.swift renamed to Sources/SwiftSyntaxBuilder/gyb_generated/SyntaxExpressibleByStringInterpolationConformances.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
@_spi(RawSyntax) import SwiftSyntax
16+
@_spi(RawSyntax) import SwiftParser
1617

1718
extension DeclSyntaxProtocol {
1819
public static func parse(from parser: inout Parser) -> Self {

Tests/SwiftParserTest/StringInterpolation.swift renamed to Tests/SwiftSyntaxBuilderTest/StringInterpolation.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import SwiftSyntax
2+
import SwiftSyntaxBuilder
23
import SwiftParser
34

45
import XCTest

0 commit comments

Comments
 (0)