-
Notifications
You must be signed in to change notification settings - Fork 57
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
feat: Add set operation (select ... union select ...) for insert stat… #200
feat: Add set operation (select ... union select ...) for insert stat… #200
Conversation
feat: Add comment on FUNCTION and EXTENSION. feat: Add SET and RESET statement.
… postgres syntax. The empty list or arguments also appear in the CST.
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.
something interesting's happening here: state count is much higher in this branch (7776 vs 4536 on main), which I think is largely down to the addition of function argument modes -- invocation
punches way above its weight class (big increases also in binary_expression
, between_expression
, implicit_cast
, and a bunch of types like double
and tinyint
-- maybe due to the time additions?). Large state count has dropped by a lot, though, 775 in main to 333 here, and build time from an empty src/ is actually around ten seconds faster on my machine. Do you know what's happening here?
also if you have more changes in the mean time please create separate pull requests! this one's getting unwieldy
grammar.js
Outdated
@@ -551,8 +558,21 @@ module.exports = grammar({ | |||
nchar: $ => parametric_type($, $.keyword_nchar), | |||
nvarchar: $ => parametric_type($, $.keyword_nvarchar), | |||
|
|||
_time_zone: $ => seq( |
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.
_time_zone: $ => seq( | |
_include_time_zone: $ => seq( |
this is clearer imo, but I definitely like the more detailed deconstruction of timestamps overall!
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.
Fine by me.
How do you get the number of parser states ? |
The state count is shown in the generated parser.c |
yeah, |
Here is all the numbers f75b8ea 531d243 bec206c c223823 1e3f464 bde914f 1a2b0da 970b548 385aff4 (main) |
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.
Hi, thanks for you PR. I have made some remarks. Would be nice If you could address them.
For future PRs, I would be nice if you could limit the scope of the PR to one topic and don't let the PR get too large. I makes it hard to review. If I am not mistaken, most of the suggested changes have nothing to do with the title of the PR either. A (very short) description of what you want to address/change/implement is also welcome.
grammar.js
Outdated
keyword_session: _ => make_keyword("session"), | ||
keyword_isolation: _ => make_keyword("isolation"), | ||
keyword_level: _ => make_keyword("level"), | ||
keyword_serializable: _ => make_keyword("seria"), |
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.
is this called seria? I have search pg and mariadb docs and was not able to find this. Can you give me an example?
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.
It is a typo.
grammar.js
Outdated
keyword_repeatable: _ => make_keyword("repeatable: _ ="), | ||
keyword_read: _ => make_keyword("read: _ =>"), |
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.
Again, I was not able to fin this structure in PG and MariaDB. Also separating tokens in the keyword statement is not the right way. In SQL there can be multiple spaces/tabs between tokens.
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.
Same as before a keyboard macro typo.
@@ -735,6 +757,31 @@ module.exports = grammar({ | |||
), | |||
), | |||
|
|||
_argmode: $ => choice( |
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.
can you add one or two test cases for this?
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.
done
@@ -904,6 +961,54 @@ module.exports = grammar({ | |||
), | |||
), | |||
|
|||
reset_statement: $ => seq( |
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.
Again, can you add test cases here?
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.
done
Add test to set/reset statement. Correct keyword typos. Add test on function arguments with default value and IN/OUT mode.
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.
@matthias-Q if you're alright with the current state feel free to land it, or let me know and I can later 🚀
…ements.