Skip to content

Commit ef1bf91

Browse files
committed
tbs
1 parent 62b7752 commit ef1bf91

File tree

2 files changed

+9
-27
lines changed

2 files changed

+9
-27
lines changed

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)