Skip to content

Commit dc4e479

Browse files
committed
tbs
1 parent 62b7752 commit dc4e479

File tree

4 files changed

+11
-31
lines changed

4 files changed

+11
-31
lines changed

Sources/SwiftParser/Declarations.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ extension TokenConsumer {
5252
}
5353
}
5454

55-
/// Check if the current token is at a start of any declaration.
56-
///
55+
/// Returns `true` if the current token represents the start of a declaration
56+
/// item.
5757
///
5858
/// - Parameters
5959
/// - allowInitDecl: whether to consider 'init' a declaration in the context.

Sources/SwiftParser/Statements.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ extension TokenConsumer {
2121
/// item.
2222
///
2323
/// - Parameters:
24-
/// - allowRecovery: Whether to attempt to perform recovery.
2524
/// - preferExpr: If either an expression or statement could be
2625
/// parsed and this parameter is `true`, the function returns `false`
2726
/// such that an expression can be parsed.
@@ -1022,7 +1021,6 @@ extension Parser.Lookahead {
10221021
/// item.
10231022
///
10241023
/// - Parameters:
1025-
/// - allowRecovery: Whether to attempt to perform recovery.
10261024
/// - preferExpr: If either an expression or statement could be
10271025
/// parsed and this parameter is `true`, the function returns `false`
10281026
/// such that an expression can be parsed.

Sources/SwiftParser/TokenPrecedence.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ enum TokenPrecedence: Comparable {
3838
case mediumPunctuator
3939
/// The closing delimiter of `weakBracketed`
4040
case weakBracketClose
41-
/// Keywords that start a new statement.
42-
case stmtKeyword
4341
/// The '{' token because it typically marks the body of a declaration.
4442
/// `closingDelimiter` must have type `strongPunctuator`
4543
case openingBrace(closingDelimiter: RawTokenKind)
4644
/// A punctuator that is a strong indicator that it separates two distinct parts of the source code, like two statements
4745
case strongPunctuator
4846
/// The closing delimiter of `strongBracketed`
4947
case closingBrace
50-
/// Tokens that start a new declaration
48+
/// Keywords that start a new statement.
49+
case stmtKeyword
50+
/// Keywords that start a new declaration
5151
case declKeyword
5252
case openingPoundIf
5353
case closingPoundIf
@@ -85,17 +85,17 @@ enum TokenPrecedence: Comparable {
8585
case .weakBracketClose:
8686
return 6
8787
case .strongPunctuator:
88-
return 8
88+
return 7
8989
case .openingBrace:
90-
return 9
90+
return 8
9191
case .declKeyword, .stmtKeyword:
92-
return 10
92+
return 9
9393
case .closingBrace:
94-
return 11
94+
return 10
9595
case .openingPoundIf:
96-
return 12
96+
return 11
9797
case .closingPoundIf:
98-
return 13
98+
return 12
9999
}
100100
}
101101

Sources/SwiftParser/TopLevel.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -133,24 +133,6 @@ extension Parser {
133133
)
134134
}
135135

136-
mutating func fixWithSemi(codeBlockItem item: RawCodeBlockItemSyntax.Item) -> RawCodeBlockItemSyntax? {
137-
let semi = self.consume(if: .semicolon)
138-
var trailingSemis: [RawTokenSyntax] = []
139-
while let trailingSemi = self.consume(if: .semicolon) {
140-
trailingSemis.append(trailingSemi)
141-
}
142-
143-
if item.raw.isEmpty && semi == nil && trailingSemis.isEmpty {
144-
return nil
145-
}
146-
return RawCodeBlockItemSyntax(
147-
item: item,
148-
semicolon: semi,
149-
RawUnexpectedNodesSyntax(trailingSemis, arena: self.arena),
150-
arena: self.arena
151-
)
152-
}
153-
154136
/// Parse an individual item - either in a code block or at the top level.
155137
///
156138
/// Returns `nil` if the parser did not consume any tokens while trying to

0 commit comments

Comments
 (0)