Skip to content

Commit f5f6ae2

Browse files
authored
Merge pull request #1191 from ahoppen/ahoppen/lexer-errors-in-token
Refactor the lexer to store lexer errors in the tokens instead of having a diagnosticsHandler
2 parents fa99e37 + 8345eac commit f5f6ae2

20 files changed

+414
-209
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ let package = Package(
9696
),
9797
.target(
9898
name: "SwiftParser",
99-
dependencies: ["SwiftDiagnostics", "SwiftSyntax"],
99+
dependencies: ["SwiftSyntax"],
100100
exclude: [
101101
"CMakeLists.txt",
102102
"README.md",

Sources/SwiftParser/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ add_swift_host_library(SwiftParser
1414
Directives.swift
1515
Expressions.swift
1616
Lexer.swift
17-
LexerDiagnosticMessages.swift
1817
Lookahead.swift
1918
LoopProgressCondition.swift
2019
Modifiers.swift

Sources/SwiftParser/Declarations.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,9 +1222,8 @@ extension Parser {
12221222
(buffer: UnsafeBufferPointer<UInt8>) -> Bool in
12231223
var cursor = Lexer.Cursor(input: buffer, previous: 0)
12241224
guard buffer[0] == UInt8(ascii: "/") else { return false }
1225-
1226-
switch (cursor.lexOperatorIdentifier(cursor, cursor)) {
1227-
case (.unknown, _):
1225+
switch cursor.lexOperatorIdentifier(cursor, cursor).tokenKind {
1226+
case .unknown:
12281227
return false
12291228

12301229
default:

Sources/SwiftParser/Expressions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ extension Parser {
15841584
wholeText: wholeText,
15851585
textRange: textRange,
15861586
presence: .present,
1587-
hasLexerError: false,
1587+
lexerError: nil,
15881588
arena: self.arena
15891589
)
15901590
}

0 commit comments

Comments
 (0)