Skip to content

Commit 0906e0d

Browse files
committed
Add comments explaining why we don't need a semicolon if we see GO
1 parent 33cf075 commit 0906e0d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/parser/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,8 @@ impl<'a> Parser<'a> {
496496
break;
497497
}
498498

499+
// MSSQL: the `GO` keyword is a batch separator which also means it concludes the current statement
500+
// `GO` may not be followed by a semicolon, so turn off that expectation
499501
if expecting_statement_delimiter && word.keyword == Keyword::GO {
500502
expecting_statement_delimiter = false;
501503
}
@@ -508,7 +510,8 @@ impl<'a> Parser<'a> {
508510
}
509511

510512
let statement = self.parse_statement()?;
511-
// Treat batch delimiter as an end of statement, so no additional statement delimiter expected here
513+
// MSSQL: the `GO` keyword is a batch separator which also means it concludes the current statement
514+
// `GO` may not be followed by a semicolon, so turn off that expectation
512515
expecting_statement_delimiter = !matches!(statement, Statement::Go(_));
513516
stmts.push(statement);
514517
}

0 commit comments

Comments
 (0)