Skip to content

Commit

Permalink
reset lexer state
Browse files Browse the repository at this point in the history
see: #2764
  • Loading branch information
yaacovCR committed Nov 10, 2024
1 parent 1d98a6a commit 48e1824
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/language/lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export class Lexer {
*/
lookahead(): Token {
let token = this.token;
const savedLine = this.line;
const savedLineStart = this.lineStart;
if (token.kind !== TokenKind.EOF) {
do {
if (token.next) {
Expand All @@ -81,6 +83,8 @@ export class Lexer {
}
} while (token.kind === TokenKind.COMMENT);
}
this.line = savedLine;
this.lineStart = savedLineStart;
return token;
}
}
Expand Down

0 comments on commit 48e1824

Please sign in to comment.