From fe92e978f922b7c8caf8d43604d39f419f963749 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Thu, 10 Oct 2024 00:16:11 -0400 Subject: [PATCH] fix(lib): properly reset the lexer's start postiion --- lib/src/lexer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/lexer.c b/lib/src/lexer.c index 3049c012..76cdc7f3 100644 --- a/lib/src/lexer.c +++ b/lib/src/lexer.c @@ -367,7 +367,10 @@ void ts_lexer_finish(Lexer *self, uint32_t *lookahead_end_byte) { // If the token ended at an included range boundary, then its end position // will have been reset to the end of the preceding range. Reset the start // position to match. - if (self->token_end_position.bytes < self->token_start_position.bytes) { + if ( + self->token_end_position.bytes < self->token_start_position.bytes || + point_lt(self->token_end_position.extent, self->token_start_position.extent) + ) { self->token_start_position = self->token_end_position; }