Skip to content
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

add full outer joins #130

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module.exports = grammar({
keyword_left: _ => make_keyword("left"),
keyword_right: _ => make_keyword("right"),
keyword_inner: _ => make_keyword("inner"),
keyword_full: _ => make_keyword("full"),
keyword_outer: _ => make_keyword("outer"),
keyword_cross: _ => make_keyword("cross"),
keyword_join: _ => make_keyword("join"),
Expand Down Expand Up @@ -1677,10 +1678,12 @@ module.exports = grammar({
choice(
$.keyword_cross,
$.keyword_left,
seq($.keyword_full, $.keyword_outer),
seq($.keyword_left, $.keyword_outer),
$.keyword_right,
seq($.keyword_right, $.keyword_outer),
$.keyword_inner,
$.keyword_full,
),
),
$.keyword_join,
Expand Down
37 changes: 36 additions & 1 deletion test/corpus/select.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,11 @@ ON a.id = d.d_id
RIGHT OUTER JOIN table_d d
ON a.id = d.d_id
INNER JOIN table_e e
ON a.id = e.e_id;
ON a.id = e.e_id
FULL OUTER JOIN table_f f
ON a.id = f.f_id
FULL JOIN table_g g
ON a.id = g.g_id;

--------------------------------------------------------------------------------

Expand Down Expand Up @@ -1145,6 +1149,37 @@ ON a.id = e.e_id;
name: (identifier))
table_alias: (identifier))
(keyword_on)
predicate: (binary_expression
left: (field
table_alias: (identifier)
name: (identifier))
right: (field
table_alias: (identifier)
name: (identifier))))
(join
(keyword_full)
(keyword_outer)
(keyword_join)
(relation
(table_reference
name: (identifier))
table_alias: (identifier))
(keyword_on)
predicate: (binary_expression
left: (field
table_alias: (identifier)
name: (identifier))
right: (field
table_alias: (identifier)
name: (identifier))))
(join
(keyword_full)
(keyword_join)
(relation
(table_reference
name: (identifier))
table_alias: (identifier))
(keyword_on)
predicate: (binary_expression
left: (field
table_alias: (identifier)
Expand Down