-
Notifications
You must be signed in to change notification settings - Fork 623
Support optional semicolon between statements #1937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -2480,3 +2492,15 @@ fn parse_mssql_grant() { | |||
fn parse_mssql_deny() { | |||
ms().verified_stmt("DENY SELECT ON my_table TO public, db_admin"); | |||
} | |||
|
|||
#[test] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have a similar test or move this over to common.rs? thinking since this flag is being added to the parser itself, it feels a bit like it could be lost if only tested here within mssql
src/parser/mod.rs
Outdated
@@ -222,13 +222,17 @@ pub struct ParserOptions { | |||
/// Controls how literal values are unescaped. See | |||
/// [`Tokenizer::with_unescape`] for more details. | |||
pub unescape: bool, | |||
/// Controls if the parser expects a semi-colon token | |||
/// between statements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking it might be helpful if we include in the doc that the default is true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks @yoavcloud!
cc @alamb
I went to rebase #1843 and noticed this PR had been merged. Great! I see we had similar thoughts on how to approach it. I closed my PR. However, my PR also introduced a lot more testing for the feature missing from this PR. I'll open a separate PR for more test coverage if it turns out to be needed. |
Havign some more test coverage would be great -- if you have the time to make one please ping me and I will be happy to review it |
T-SQL scripts do not require a semicolon as a statement delimiter. Added a new parser option to not require semicolons, as introducing this at the dialect level seems to be very intrusive. Also added a
tsql()
function to create an MS SQL dialect for testing with the new option.