Skip to content

Commit

Permalink
Reduce select statement states
Browse files Browse the repository at this point in the history
  • Loading branch information
Ce11an committed Aug 18, 2024
1 parent 1cac1d3 commit e278de1
Show file tree
Hide file tree
Showing 5 changed files with 55,275 additions and 54,974 deletions.
67 changes: 34 additions & 33 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,47 +538,48 @@ module.exports = grammar({

select_statement: $ =>
seq(
$.keyword_select,
choice(
seq($.keyword_value, $.predicate),
commaSeparated($.inclusive_predicate),
),
$.keyword_from,
optional($.keyword_only),
choice(
$.statement,
seq(
commaSeparated($.value),
optional($.with_clause),
optional($.where_clause),
optional($.split_clause),
optional($.group_clause),
optional($.order_clause),
optional($.limit_clause),
optional($.fetch_clause),
optional($.timeout_clause),
optional($.parallel_clause),
optional($.explain_clause),
),
),
$.select_clause,
optional($.omit_clause),
$.from_clause,
),

live_select_statement: $ =>
seq(
$.keyword_live,
$.keyword_select,
choice(
$.keyword_diff,
seq($.keyword_value, $.predicate),
commaSeparated($.inclusive_predicate),
),
$.keyword_from,
commaSeparated(choice($.identifier, $.record_id)),
optional($.where_clause),
optional($.fetch_clause),
$.select_statement,
),

// Clauses

select_clause: $ => seq(
$.keyword_select,
choice(
seq($.keyword_value, $.predicate),
commaSeparated($.inclusive_predicate),
),
),

from_clause: $ => seq(
$.keyword_from,
optional($.keyword_only),
choice(
$.statement,
seq(
commaSeparated($.value),
optional($.with_clause),
optional($.where_clause),
optional($.split_clause),
optional($.group_clause),
optional($.order_clause),
optional($.limit_clause),
optional($.fetch_clause),
optional($.timeout_clause),
optional($.parallel_clause),
optional($.explain_clause),
),
),
),

omit_clause: $ => seq($.keyword_omit, $.value),

with_clause: $ =>
Expand Down
176 changes: 44 additions & 132 deletions src/grammar.json

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

Loading

0 comments on commit e278de1

Please sign in to comment.