Skip to content

Commit 70dbfa6

Browse files
ahoppenCodaFiDougGregorrintaro
committed
Add a Swift parser library that is written in Swift
This starts an effort to implement the parser for the Swift compiler in Swift itself. Co-authored-by: Robert Widmann <[email protected]> Co-authored-by: Doug Gregor <[email protected]> Co-authored-by: Rintaro Ishizaki <[email protected]>
1 parent 1313c36 commit 70dbfa6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+15750
-1
lines changed

Package.swift

+25-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ let package = Package(
4545
.macCatalyst(.v13),
4646
],
4747
products: [
48+
.library(name: "SwiftParser", type: .static, targets: ["SwiftParser"]),
4849
.library(name: "SwiftSyntax", type: .static, targets: ["SwiftSyntax"]),
4950
.library(name: "SwiftSyntaxParser", type: .static, targets: ["SwiftSyntaxParser"]),
5051
.library(name: "SwiftSyntaxBuilder", type: .static, targets: ["SwiftSyntaxBuilder"]),
@@ -101,10 +102,18 @@ let package = Package(
101102
name: "_SwiftSyntaxTestSupport",
102103
dependencies: ["SwiftSyntax"]
103104
),
105+
.target(
106+
name: "SwiftParser",
107+
dependencies: ["SwiftSyntax"]
108+
),
104109
.executableTarget(
105110
name: "lit-test-helper",
106111
dependencies: ["SwiftSyntax", "SwiftSyntaxParser"]
107112
),
113+
.executableTarget(
114+
name: "swift-parser-test",
115+
dependencies: ["SwiftSyntax", "SwiftParser", .product(name: "ArgumentParser", package: "swift-argument-parser")]
116+
),
108117
.executableTarget(
109118
name: "generate-swift-syntax-builder",
110119
dependencies: ["SwiftSyntaxBuilder"],
@@ -144,12 +153,27 @@ let package = Package(
144153
),
145154
.testTarget(
146155
name: "PerformanceTest",
147-
dependencies: ["SwiftSyntax", "SwiftSyntaxParser"],
156+
dependencies: ["SwiftSyntax", "SwiftSyntaxParser", "SwiftParser"],
148157
exclude: ["Inputs"]
149158
),
159+
.testTarget(
160+
name: "SwiftParserTest",
161+
dependencies: ["SwiftParser", "_SwiftSyntaxTestSupport"]
162+
),
150163
]
151164
)
152165

166+
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
167+
// Building standalone.
168+
package.dependencies += [
169+
.package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.0.1")),
170+
]
171+
} else {
172+
package.dependencies += [
173+
.package(path: "../swift-argument-parser")
174+
]
175+
}
176+
153177
#if swift(>=5.6)
154178
// If `SWIFTCI_USE_LOCAL_DEPS` is set, we are in a CI enviornment that might disallow
155179
// internet access, so we can't load swift-docc-plugin. Simply don't load it in these

0 commit comments

Comments
 (0)