Skip to content

Commit

Permalink
Parse more functionality of the CREATE TABLE statement (#70)
Browse files Browse the repository at this point in the history
* Add `create unlogged table`

* Add: `create table as select`

* include generated files

* Add `create table ... on commit`

* fix: either `table_definition` or `as select`

* add autogenerated files

* create as select with two choices

* removed `on commit` for now

* Default values in Column Definitions (#73)

* Add: column definitions with default values

* Add more options to default expressions

* update _column_constraints

* include generated files

* bump generated files

* update parser.c after rebase
  • Loading branch information
matthias-Q authored Jan 31, 2023
1 parent bb58ae1 commit 286e10c
Show file tree
Hide file tree
Showing 5 changed files with 91,543 additions and 90,656 deletions.
30 changes: 27 additions & 3 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ module.exports = grammar({
keyword_owner: _ => make_keyword("owner"),
keyword_temp: _ => make_keyword("temp"),
keyword_temporary: _ => make_keyword("temporary"),
keyword_unlogged: _ => make_keyword("unlogged"),
keyword_union: _ => make_keyword("union"),
keyword_all: _ => make_keyword("all"),
keyword_except: _ => make_keyword("except"),
Expand Down Expand Up @@ -152,6 +153,7 @@ module.exports = grammar({
keyword_brin: _ => make_keyword("brin"),
keyword_like: _ => choice(make_keyword("like"),make_keyword("ilike")),
keyword_similar: _ => make_keyword("similar"),
keyword_preserve: _ => make_keyword("preserve"),

// Operators
is_not: $ => prec.left(seq($.keyword_is, $.keyword_not)),
Expand Down Expand Up @@ -514,12 +516,34 @@ module.exports = grammar({

create_table: $ => seq(
$.keyword_create,
optional($._temporary),
optional(
choice(
$._temporary,
$.keyword_unlogged
)
),
$.keyword_table,
optional($._if_not_exists),
$.table_reference,
$.column_definitions,
optional($.table_options),
choice(
seq(
$.column_definitions,
optional($.table_options),
optional(
seq(
$.keyword_as,
$._select_statement,
),
)
),
seq(
optional($.table_options),
seq(
$.keyword_as,
$._select_statement,
),
),
)
),

create_view: $ => seq(
Expand Down
97 changes: 87 additions & 10 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 37 additions & 1 deletion src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 286e10c

Please sign in to comment.