File tree Expand file tree Collapse file tree 2 files changed +3
-14
lines changed
Sources/SwiftParser/Lexer Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -1772,6 +1772,8 @@ extension Lexer.Cursor {
17721772 }
17731773
17741774 mutating func lexInStringLiteral( stringLiteralKind: StringLiteralKind , delimiterLength: Int ) -> Lexer . Result {
1775+ if self . isAtEndOfFile { return . init( . eof) }
1776+
17751777 var error : LexingDiagnostic ? = nil
17761778
17771779 while true {
Original file line number Diff line number Diff line change @@ -43,20 +43,7 @@ extension Lexer {
4343
4444 mutating func advance( ) -> Lexer . Lexeme {
4545 defer {
46- if self . cursor. isAtEndOfFile {
47- self . nextToken = Lexeme (
48- tokenKind: . eof,
49- flags: [ ] ,
50- diagnostic: nil ,
51- start: self . cursor. pointer,
52- leadingTriviaLength: 0 ,
53- textLength: 0 ,
54- trailingTriviaLength: 0 ,
55- cursor: self . cursor
56- )
57- } else {
58- self . nextToken = self . cursor. nextToken ( sourceBufferStart: self . sourceBufferStart, stateAllocator: lexerStateAllocator)
59- }
46+ self . nextToken = self . cursor. nextToken ( sourceBufferStart: self . sourceBufferStart, stateAllocator: lexerStateAllocator)
6047 }
6148 return self . nextToken
6249 }
You can’t perform that action at this time.
0 commit comments