Skip to content

Commit ad30a7b

Browse files
authored
Merge pull request #2212 from ahoppen/ahoppen/update-readme
Update README.md
2 parents d3a73af + dd02513 commit ad30a7b

File tree

2 files changed

+15
-82
lines changed

2 files changed

+15
-82
lines changed

Examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Each example can be executed by navigating into this folder and running `swift r
55
- [AddOneToIntegerLiterals](Sources/AddOneToIntegerLiterals/AddOneToIntegerLiterals.swift): Command line tool to add 1 to every integer literal in a source file
66
- [CodeGenerationUsingSwiftSyntaxBuilder](Sources/CodeGenerationUsingSwiftSyntaxBuilder/CodeGenerationUsingSwiftSyntaxBuilder.swift): Code-generate a simple source file using SwiftSyntaxBuilder
77
- [ExamplePlugin](Sources/ExamplePlugin): Compiler plugin executable using [`SwiftCompilerPlugin`](../Sources/SwiftCompilerPlugin)
8+
- [MacroExamples](Sources/MacroExamples): A collection of Swift macros
89

910
Furthermore, SwiftSyntax uses [`SwiftSyntaxBuilder`](../Sources/SwiftSyntaxBuilder) extensively to generate its own code. That code can be found in the [CodeGeneration](../CodeGeneration) package.
1011

README.md

Lines changed: 14 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,38 @@
1-
# SwiftSyntax
1+
# Swift Syntax
22

3-
SwiftSyntax is a set of Swift libraries for parsing, inspecting, generating, and transforming Swift source code.
3+
The swift-syntax package is a set of libraries that work on a source-accurate tree representation of Swift source code, called the SwiftSyntax tree. The SwiftSyntax tree forms the backbone of Swift’s macro system – the macro expansion nodes are represented as SwiftSyntax nodes and a macro generates a SwiftSyntax tree to be inserted into the source file.
44

55
## Documentation
66

77
You can read SwiftSyntax’s documentation on [swiftpackageindex.com](https://swiftpackageindex.com/apple/swift-syntax/documentation).
88

99
A great way to interactively explore the SwiftSyntax tree of a source file is https://swift-ast-explorer.com, developed by [@kishikawakatsumi](https://github.com/kishikawakatsumi).
1010

11-
## Adding SwiftSyntax as a Dependency
11+
A set of example usages of swift-syntax can be found in [Examples](Examples).
1212

13-
### Trunk Development (main)
13+
## Releases
1414

15-
The mainline branch of SwiftSyntax tracks the latest developments. It is not
16-
an official release, and is subject to rapid changes in APIs and behaviors. To
17-
use it, add this repository to the `Package.swift` manifest of your project:
15+
Releases of SwiftSyntax are aligned with corresponding language and tooling releases, for example the major version 509 of swift-syntax is aligned with Swift 5.9.
16+
17+
To depend on swift-syntax in a SwiftPM package, add the following to your `Package.swift`.
1818

19-
```swift
20-
// swift-tools-version:5.7
21-
import PackageDescription
22-
23-
let package = Package(
24-
name: "MyTool",
25-
dependencies: [
26-
.package(url: "https://github.com/apple/swift-syntax.git", branch: "main"),
27-
],
28-
targets: [
29-
.target(name: "MyTool", dependencies: [
30-
.product(name: "SwiftSyntax", package: "swift-syntax"),
31-
]),
32-
]
33-
)
34-
```
35-
36-
Mainline SwiftSyntax also includes
37-
38-
- `SwiftParser` for natively parsing source code
39-
- `SwiftOperators` for folding SwiftSyntax trees containing operators
40-
- `SwiftSyntaxBuilder` for generating Swift code with a result builder-style interface
41-
- `SwiftSyntaxMacros` for providing syntactic macro support
42-
43-
### Releases
44-
45-
Releases of SwiftSyntax are aligned with corresponding language
46-
and tooling releases and are stable. To use them,
47-
add this repository to the `Package.swift` manifest of your project:
4819

4920
```swift
50-
// swift-tools-version:5.7
51-
import PackageDescription
52-
53-
let package = Package(
54-
name: "MyTool",
55-
dependencies: [
56-
.package(url: "https://github.com/apple/swift-syntax.git", exact: "<#Specify Release tag#>"),
57-
],
58-
targets: [
59-
.target(name: "MyTool", dependencies: [
60-
.product(name: "SwiftSyntax", package: "swift-syntax"),
61-
]),
62-
]
63-
)
21+
dependencies: [
22+
.package(url: "https://github.com/apple/swift-syntax.git", from: "<#latest swift-syntax tag#>"),
23+
],
6424
```
25+
26+
To add swift-syntax as a dependency of your Xcode project, go to the *Package Dependencies* tab of your Xcode project, click the plus button and search for https://github.com/apple/swift-syntax.git.
6527

66-
Replace `<#Specify Release tag#>` by the version of SwiftSyntax that you want to use (see the following table for mapping details).
67-
68-
| Xcode Release | Swift Release Tag | SwiftSyntax Release Tag |
69-
|:-------------------:|:-------------------:|:-------------------------:|
70-
| Xcode 14.3 | swift-5.8-RELEASE | 508.0.0 |
71-
| Xcode 14.0 | swift-5.7-RELEASE | 0.50700.1 |
72-
| Xcode 13.3 | swift-5.6-RELEASE | 0.50600.1 |
73-
| Xcode 13.0 | swift-5.5-RELEASE | 0.50500.0 |
74-
| Xcode 12.5 | swift-5.4-RELEASE | 0.50400.0 |
75-
| Xcode 12.0 | swift-5.3-RELEASE | 0.50300.0 |
76-
| Xcode 11.4 | swift-5.2-RELEASE | 0.50200.0 |
77-
78-
## Documentation
79-
80-
SwiftSyntax uses [DocC](https://developer.apple.com/documentation/docc) bundles
81-
for its documentation. To view rendered documentation in Xcode, open the
82-
SwiftSyntax package and select
83-
84-
```
85-
Product > Build Documentation
86-
```
87-
88-
Associated articles are written in markdown, and can be viewed in a browser,
89-
text editor, or IDE.
28+
## Reporting Issues
9029

91-
- [SwiftSyntax](Sources/SwiftSyntax/Documentation.docc)
92-
- [SwiftParser](Sources/SwiftParser/SwiftParser.docc)
93-
- [SwiftOperators](Sources/SwiftOperators/SwiftOperators.docc)
94-
- [SwiftSyntaxMacros](Sources/SwiftSyntaxMacros/SwiftSyntaxMacros.docc)
30+
If you should hit any issues while using SwiftSyntax, we appreciate bug reports on [GitHub Issue](https://github.com/apple/swift-syntax/issues).
9531

9632
## Contributing
9733

9834
Start contributing to SwiftSyntax see [this guide](CONTRIBUTING.md) for more information.
9935

100-
## Reporting Issues
101-
102-
If you should hit any issues while using SwiftSyntax, we appreciate bug reports on [GitHub Issue](https://github.com/apple/swift-syntax/issues).
103-
10436
## Bazel
10537

10638
SwiftSyntax provides an experimental [Bazel](https://bazel.build) build configuration, maintained by Keith Smiley.

0 commit comments

Comments
 (0)