Skip to content

Commit 759043e

Browse files
authored
Merge pull request #1227 from ahoppen/ahoppen/refactor-lexer
Refactor the lexer to make it easier to understand, maintain and more swifty
2 parents b931534 + 8addb9a commit 759043e

File tree

11 files changed

+1735
-1443
lines changed

11 files changed

+1735
-1443
lines changed

Sources/SwiftParser/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ add_swift_host_library(SwiftParser
1313
Declarations.swift
1414
Directives.swift
1515
Expressions.swift
16-
Lexer.swift
1716
Lookahead.swift
1817
LoopProgressCondition.swift
1918
Modifiers.swift
@@ -34,7 +33,14 @@ add_swift_host_library(SwiftParser
3433

3534
generated/DeclarationModifier.swift
3635
generated/Parser+Entry.swift
37-
generated/TypeAttribute.swift)
36+
generated/TypeAttribute.swift
37+
38+
Lexer/Cursor.swift
39+
Lexer/Lexeme.swift
40+
Lexer/LexemeSequence.swift
41+
Lexer/Lexer.swift
42+
Lexer/UnicodeScalarExtensions.swift
43+
)
3844

3945
target_link_libraries(SwiftParser PUBLIC
4046
SwiftSyntax

Sources/SwiftParser/Declarations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ extension Parser {
12531253
(buffer: UnsafeBufferPointer<UInt8>) -> Bool in
12541254
var cursor = Lexer.Cursor(input: buffer, previous: 0, state: .normal)
12551255
guard buffer[0] == UInt8(ascii: "/") else { return false }
1256-
switch cursor.lexOperatorIdentifier(cursor, cursor).tokenKind {
1256+
switch cursor.lexOperatorIdentifier(sourceBufferStart: cursor).tokenKind {
12571257
case .unknown:
12581258
return false
12591259

0 commit comments

Comments
 (0)