Skip to content

Commit 8f3aec1

Browse files
authored
refactor(postgresql): simplify select_no_parens (#22)
Unify the `with_clause` into the first candidate of the `select_no_parens` rule by making it optional. Simplify the rule and avoid redundancy.
1 parent dc48a50 commit 8f3aec1

File tree

2 files changed

+4393
-4468
lines changed

2 files changed

+4393
-4468
lines changed

postgresql/PostgreSQLParser.g4

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2821,8 +2821,7 @@ select_with_parens
28212821
;
28222822

28232823
select_no_parens
2824-
: select_clause opt_sort_clause? (for_locking_clause opt_select_limit? | select_limit opt_for_locking_clause?)?
2825-
| with_clause select_clause opt_sort_clause? (for_locking_clause opt_select_limit? | select_limit opt_for_locking_clause?)?
2824+
: with_clause? select_clause opt_sort_clause? (for_locking_clause opt_select_limit? | select_limit opt_for_locking_clause?)?
28262825
;
28272826

28282827
select_clause
@@ -3549,7 +3548,13 @@ plsqlvariablename
35493548
;
35503549

35513550
func_application
3552-
: func_name OPEN_PAREN (func_arg_list (COMMA VARIADIC func_arg_expr)? opt_sort_clause? | VARIADIC func_arg_expr opt_sort_clause? | (ALL | DISTINCT) func_arg_list opt_sort_clause? | STAR |) CLOSE_PAREN
3551+
: func_name OPEN_PAREN (
3552+
func_arg_list (COMMA VARIADIC func_arg_expr)? opt_sort_clause?
3553+
| VARIADIC func_arg_expr opt_sort_clause?
3554+
| (ALL | DISTINCT) func_arg_list opt_sort_clause?
3555+
| STAR
3556+
|
3557+
) CLOSE_PAREN
35533558
;
35543559

35553560
func_expr

0 commit comments

Comments
 (0)