File tree Expand file tree Collapse file tree 2 files changed +3
-33
lines changed
Sources/SwiftFormatPrettyPrint Expand file tree Collapse file tree 2 files changed +3
-33
lines changed Original file line number Diff line number Diff line change @@ -233,15 +233,15 @@ Tokens = [docBlock(" Doc Block comment\n * Second line *")]
233233Verbatim tokens are used to print text verbatim without any formatting apart
234234from applying a global indentation. They have a length set to the maximum line
235235width. 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
237237substructure of the syntax node a manner useful for formatting, so we print them
238238verbatim. The indentation for verbatim tokens is applied to the first line of
239239the text. The relative indentation of subsequent lines is preserved unless they
240240have less indentation than the first line, in which case we set the indentation
241241of those lines equal to the first.
242242
243243```
244- // Consider "ifnt", an unknown syntax structure:
244+ // Consider "ifnt", an unexpected syntax structure:
245245
246246if someCondition {
247247 ifnt anotherCondition {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments