Skip to content

Commit 8856ffd

Browse files
another adaptation for token size
1 parent d8bbcd2 commit 8856ffd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sqlmesh/core/dialect.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,10 @@ def _parse_if(self: Parser) -> t.Optional[exp.Expr]:
566566
if last_token.token_type == TokenType.R_PAREN:
567567
self._tokens[-2].comments.extend(last_token.comments)
568568
self._tokens.pop()
569+
if hasattr(self, "_tokens_size"):
570+
# keep _tokens_size in sync sqlglot 30.0.3 caches len(_tokens)
571+
# _advance() tries to read tokens[index + 1] past the new end
572+
self._tokens_size -= 1
569573
else:
570574
self.raise_error("Expecting )")
571575

0 commit comments

Comments
 (0)