Skip to content

Commit 6291812

Browse files
Recognize \t as an indent
1 parent 1556ade commit 6291812

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lpython/parser/tokenizer.re

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ int Tokenizer::lex(Allocator &al, YYSTYPE &yylval, Location &loc, diag::Diagnost
315315
RET(TK_INDENT);
316316
} else {
317317
if(last_token == yytokentype::TK_NEWLINE && cur[0] != ' '
318-
&& last_indent_length > cur-tok) {
318+
&& cur[0] != '\t' && last_indent_length > cur-tok) {
319319
last_indent_length = cur-tok;
320320
dedent = 2;
321321
if (!indent_length.empty()) {
@@ -368,8 +368,8 @@ int Tokenizer::lex(Allocator &al, YYSTYPE &yylval, Location &loc, diag::Diagnost
368368
|| colon_actual_last_token) {
369369
colon_actual_last_token = false;
370370
indent = true;
371-
} else if (cur[0] != ' ' && cur[0] != '\n'
372-
&& last_indent_length > cur-tok) {
371+
} else if (cur[0] != ' ' && cur[0] != '\t' && cur[0] != '\n'
372+
&& last_indent_length >= cur-tok) {
373373
last_indent_length = 0;
374374
dedent = 1;
375375
}

0 commit comments

Comments
 (0)