Skip to content

Commit

Permalink
feat: add binary between expression
Browse files Browse the repository at this point in the history
feat: between as extra node

feat: (not) between expressions
  • Loading branch information
matthias-Q committed Mar 13, 2023
1 parent b2f6b30 commit a8622bb
Show file tree
Hide file tree
Showing 5 changed files with 387,183 additions and 71 deletions.
17 changes: 17 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = grammar({
'binary_relation',
'binary_concat',
'pattern_matching',
'between',
'clause_connective',
'clause_disjunctive',
],
Expand Down Expand Up @@ -1765,6 +1766,7 @@ module.exports = grammar({
$.unary_expression,
$.array,
$.interval,
$.between_expression,
)
),

Expand Down Expand Up @@ -1826,6 +1828,21 @@ module.exports = grammar({
),
),

between_expression: $ => choice(
...[
[$.keyword_between, 'between'],
[seq($.keyword_not, $.keyword_between), 'between'],
].map(([operator, precedence]) =>
prec.left(precedence, seq(
field('left', $._expression),
field('operator', operator),
field('low', $._expression),
$.keyword_and,
field('high', $._expression)
))
),
),

subquery: $ => seq(
'(',
$.select,
Expand Down
Loading

0 comments on commit a8622bb

Please sign in to comment.