Skip to content

Commit c9f94dc

Browse files
authored
Fixed indentStack (#43)
1 parent d5f42ea commit c9f94dc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tokenizer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,13 @@ export class Tokenizer {
450450
if (this.indentStack.length == 0) {
451451
throw new TokenizerErrors.InconsistentIndentError(this.line, this.col, this.source, this.current);
452452
}
453-
const prev = this.indentStack.pop();
453+
const prev = this.indentStack[this.indentStack.length - 1];
454454
if (prev === undefined || prev === null) {
455455
throw new TokenizerErrors.InconsistentIndentError(this.line, this.col, this.source, this.current);
456456
}
457457
const indents = Math.floor((prev - accLeadingWhiteSpace) / 4);
458458
for (let i = 0; i < indents; ++i) {
459+
this.indentStack.pop();
459460
this.addToken(TokenType.DEDENT);
460461
}
461462
}

0 commit comments

Comments
 (0)