File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Sources/SwiftParser/Lexer Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,8 @@ extension Lexer {
217
217
218
218
/// If we have already lexed a token, the kind of the previously lexed token
219
219
var previousTokenKind : RawTokenKind ?
220
+ var previousKeyword : Keyword ?
221
+
220
222
private var stateStack : StateStack = StateStack ( )
221
223
222
224
init ( input: UnsafeBufferPointer < UInt8 > , previous: UInt8 ) {
@@ -372,10 +374,9 @@ extension Lexer.Cursor {
372
374
flags. insert ( . isAtStartOfLine)
373
375
}
374
376
375
- self . previousTokenKind = result. tokenKind
376
377
diagnostic = TokenDiagnostic ( combining: diagnostic, result. error? . tokenDiagnostic ( tokenStart: cursor) )
377
378
378
- return . init (
379
+ let lexeme = Lexer . Lexeme (
379
380
tokenKind: result. tokenKind,
380
381
flags: flags,
381
382
diagnostic: diagnostic,
@@ -385,6 +386,10 @@ extension Lexer.Cursor {
385
386
trailingTriviaLength: trailingTriviaStart. distance ( to: self ) ,
386
387
cursor: cursor
387
388
)
389
+ self . previousTokenKind = result. tokenKind
390
+ self . previousKeyword = result. tokenKind == . keyword ? Keyword ( lexeme. tokenText) ! : nil
391
+
392
+ return lexeme
388
393
}
389
394
390
395
}
You can’t perform that action at this time.
0 commit comments