Skip to content

Commit e42008c

Browse files
authored
Merge pull request #454 from apple/known-unknowns
Remove References to Unknown Syntax
2 parents 94c7429 + 956687e commit e42008c

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

Documentation/PrettyPrinter.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,15 @@ Tokens = [docBlock(" Doc Block comment\n * Second line *")]
233233
Verbatim tokens are used to print text verbatim without any formatting apart
234234
from applying a global indentation. They have a length set to the maximum line
235235
width. They are typically used to handle syntax types that are classed as
236-
"unknown" by SwiftSyntax. In these cases, we don't have access to the
236+
"unexpected" by SwiftSyntax. In these cases, we don't have access to the
237237
substructure of the syntax node a manner useful for formatting, so we print them
238238
verbatim. The indentation for verbatim tokens is applied to the first line of
239239
the text. The relative indentation of subsequent lines is preserved unless they
240240
have less indentation than the first line, in which case we set the indentation
241241
of those lines equal to the first.
242242

243243
```
244-
// Consider "ifnt", an unknown syntax structure:
244+
// Consider "ifnt", an unexpected syntax structure:
245245
246246
if someCondition {
247247
ifnt anotherCondition {

Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift

+1-31
Original file line numberDiff line numberDiff line change
@@ -2357,43 +2357,13 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
23572357
return .visitChildren
23582358
}
23592359

2360-
// MARK: - Nodes representing unknown or malformed syntax
2360+
// MARK: - Nodes representing unexpected or malformed syntax
23612361

23622362
override func visit(_ node: UnexpectedNodesSyntax) -> SyntaxVisitorContinueKind {
23632363
verbatimToken(Syntax(node))
23642364
return .skipChildren
23652365
}
23662366

2367-
override func visit(_ node: UnknownDeclSyntax) -> SyntaxVisitorContinueKind {
2368-
verbatimToken(Syntax(node))
2369-
return .skipChildren
2370-
}
2371-
2372-
override func visit(_ node: UnknownExprSyntax) -> SyntaxVisitorContinueKind {
2373-
verbatimToken(Syntax(node))
2374-
return .skipChildren
2375-
}
2376-
2377-
override func visit(_ node: UnknownPatternSyntax) -> SyntaxVisitorContinueKind {
2378-
verbatimToken(Syntax(node))
2379-
return .skipChildren
2380-
}
2381-
2382-
override func visit(_ node: UnknownStmtSyntax) -> SyntaxVisitorContinueKind {
2383-
verbatimToken(Syntax(node))
2384-
return .skipChildren
2385-
}
2386-
2387-
override func visit(_ node: UnknownSyntax) -> SyntaxVisitorContinueKind {
2388-
verbatimToken(Syntax(node))
2389-
return .skipChildren
2390-
}
2391-
2392-
override func visit(_ node: UnknownTypeSyntax) -> SyntaxVisitorContinueKind {
2393-
verbatimToken(Syntax(node))
2394-
return .skipChildren
2395-
}
2396-
23972367
override func visit(_ node: NonEmptyTokenListSyntax) -> SyntaxVisitorContinueKind {
23982368
verbatimToken(Syntax(node))
23992369
return .skipChildren

0 commit comments

Comments
 (0)