Skip to content

Commit

Permalink
Merge pull request #196 from antoineB/feature/natural_join
Browse files Browse the repository at this point in the history
feat: add natural join
  • Loading branch information
matthias-Q committed Oct 2, 2023
2 parents f04e4b1 + 64c263d commit 646f3b3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ module.exports = grammar({
keyword_cross: _ => make_keyword("cross"),
keyword_join: _ => make_keyword("join"),
keyword_lateral: _ => make_keyword("lateral"),
keyword_natural: _ => make_keyword("natural"),
keyword_on: _ => make_keyword("on"),
keyword_where: _ => make_keyword("where"),
keyword_order: _ => make_keyword("order"),
Expand Down Expand Up @@ -2642,6 +2643,7 @@ module.exports = grammar({
),

join: $ => seq(
optional($.keyword_natural),
optional(
choice(
$.keyword_left,
Expand Down
1 change: 1 addition & 0 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
(keyword_columns)
(keyword_cross)
(keyword_lateral)
(keyword_natural)
(keyword_alter)
(keyword_drop)
(keyword_add)
Expand Down
17 changes: 15 additions & 2 deletions test/corpus/select.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,9 @@ 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;
ON a.id = g.g_id
NATURAL JOIN table_h h
USING (id);

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

Expand Down Expand Up @@ -1370,7 +1372,18 @@ ON a.id = g.g_id;
right: (field
(object_reference
name: (identifier))
name: (identifier)))))))
name: (identifier))))
(join
(keyword_natural)
(keyword_join)
(relation
(object_reference
name: (identifier))
alias: (identifier))
(keyword_using)
(list
(column
(identifier)))))))

================================================================================
Lateral join
Expand Down

0 comments on commit 646f3b3

Please sign in to comment.