Skip to content

Commit 98de54a

Browse files
committed
Add comments explaining why we don't need a semicolon if we see GO
1 parent 6bf9ccd commit 98de54a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/parser/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,8 @@ impl<'a> Parser<'a> {
513513
break;
514514
}
515515

516+
// MSSQL: the `GO` keyword is a batch separator which also means it concludes the current statement
517+
// `GO` may not be followed by a semicolon, so turn off that expectation
516518
if expecting_statement_delimiter && word.keyword == Keyword::GO {
517519
expecting_statement_delimiter = false;
518520
}
@@ -525,7 +527,8 @@ impl<'a> Parser<'a> {
525527
}
526528

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

0 commit comments

Comments
 (0)