Skip to content

Commit 84562b1

Browse files
committed
fix(common): #424 allTokens slice when caretTokenIndex use tokenIndexOffset
1 parent d470e72 commit 84562b1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/parser/common/basicSQL.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ export abstract class BasicSQL<
414414

415415
// A boundary consisting of the index of the input.
416416
const startIndex = startStatement?.start?.start ?? 0;
417-
const stopIndex = stopStatement?.stop?.stop ?? inputSlice.length - 1;
417+
const stopIndex = stopStatement?.stop?.stop ?? inputSlice.length;
418418

419419
/**
420420
* Save offset of the tokenIndex in the range of input
@@ -518,6 +518,7 @@ export abstract class BasicSQL<
518518
} else {
519519
if (statementCount > 1) {
520520
caretTokenIndex = caretTokenIndex - tokenIndexOffset;
521+
allTokens = allTokens.slice(tokenIndexOffset);
521522
}
522523
}
523524

0 commit comments

Comments
 (0)