Skip to content

Commit 1b2b19f

Browse files
committed
Clean up optional rules in grammar
Various rules for optional keywords contained unnecessary rules and type declarations. Remove those, thus making the output a tiny bit smaller. Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> Discussion: https://www.postgresql.org/message-id/flat/e9eed669-e32d-6919-fed4-acc0daea857b%40enterprisedb.com
1 parent 3e8ec5b commit 1b2b19f

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

src/backend/parser/gram.y

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
389389
OptTableElementList TableElementList OptInherit definition
390390
OptTypedTableElementList TypedTableElementList
391391
reloptions opt_reloptions
392-
OptWith distinct_clause opt_all_clause opt_definition func_args func_args_list
392+
OptWith distinct_clause opt_definition func_args func_args_list
393393
func_args_with_defaults func_args_with_defaults_list
394394
aggr_args aggr_args_list
395395
func_as createfunc_opt_list alterfunc_opt_list
@@ -446,7 +446,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
446446
%type <list> locked_rels_list
447447
%type <boolean> all_or_distinct
448448

449-
%type <node> join_outer join_qual
449+
%type <node> join_qual
450450
%type <jtype> join_type
451451

452452
%type <list> extract_list overlay_list position_list
@@ -461,7 +461,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
461461

462462
%type <boolean> copy_from opt_program
463463

464-
%type <ival> opt_column event cursor_options opt_hold opt_set_data
464+
%type <ival> event cursor_options opt_hold opt_set_data
465465
%type <objtype> object_type_any_name object_type_name object_type_name_on_any_name
466466
drop_type_name
467467

@@ -992,9 +992,9 @@ CreateRoleStmt:
992992
;
993993

994994

995-
opt_with: WITH {}
996-
| WITH_LA {}
997-
| /*EMPTY*/ {}
995+
opt_with: WITH
996+
| WITH_LA
997+
| /*EMPTY*/
998998
;
999999

10001000
/*
@@ -3127,8 +3127,8 @@ copy_delimiter:
31273127
;
31283128

31293129
opt_using:
3130-
USING {}
3131-
| /*EMPTY*/ {}
3130+
USING
3131+
| /*EMPTY*/
31323132
;
31333133

31343134
/* new COPY option syntax */
@@ -4319,8 +4319,8 @@ SeqOptElem: AS SimpleTypename
43194319
}
43204320
;
43214321

4322-
opt_by: BY {}
4323-
| /* empty */ {}
4322+
opt_by: BY
4323+
| /* empty */
43244324
;
43254325

43264326
NumericOnly:
@@ -4406,8 +4406,8 @@ opt_validator:
44064406
;
44074407

44084408
opt_procedural:
4409-
PROCEDURAL {}
4410-
| /*EMPTY*/ {}
4409+
PROCEDURAL
4410+
| /*EMPTY*/
44114411
;
44124412

44134413
/*****************************************************************************
@@ -5366,8 +5366,8 @@ TriggerForSpec:
53665366
;
53675367

53685368
TriggerForOptEach:
5369-
EACH {}
5370-
| /*EMPTY*/ {}
5369+
EACH
5370+
| /*EMPTY*/
53715371
;
53725372

53735373
TriggerForType:
@@ -6707,12 +6707,12 @@ fetch_args: cursor_name
67076707
}
67086708
;
67096709

6710-
from_in: FROM {}
6711-
| IN_P {}
6710+
from_in: FROM
6711+
| IN_P
67126712
;
67136713

6714-
opt_from_in: from_in {}
6715-
| /* EMPTY */ {}
6714+
opt_from_in: from_in
6715+
| /* EMPTY */
67166716
;
67176717

67186718

@@ -8836,8 +8836,8 @@ RenameStmt: ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
88368836
}
88378837
;
88388838

8839-
opt_column: COLUMN { $$ = COLUMN; }
8840-
| /*EMPTY*/ { $$ = 0; }
8839+
opt_column: COLUMN
8840+
| /*EMPTY*/
88418841
;
88428842

88438843
opt_set_data: SET DATA_P { $$ = 1; }
@@ -9859,9 +9859,9 @@ TransactionStmt:
98599859
}
98609860
;
98619861

9862-
opt_transaction: WORK {}
9863-
| TRANSACTION {}
9864-
| /*EMPTY*/ {}
9862+
opt_transaction: WORK
9863+
| TRANSACTION
9864+
| /*EMPTY*/
98659865
;
98669866

98679867
transaction_mode_item:
@@ -10066,8 +10066,8 @@ createdb_opt_name:
1006610066
* Though the equals sign doesn't match other WITH options, pg_dump uses
1006710067
* equals for backward compatibility, and it doesn't seem worth removing it.
1006810068
*/
10069-
opt_equal: '=' {}
10070-
| /*EMPTY*/ {}
10069+
opt_equal: '='
10070+
| /*EMPTY*/
1007110071
;
1007210072

1007310073

@@ -10285,8 +10285,8 @@ AlterDomainStmt:
1028510285
}
1028610286
;
1028710287

10288-
opt_as: AS {}
10289-
| /* EMPTY */ {}
10288+
opt_as: AS
10289+
| /* EMPTY */
1029010290
;
1029110291

1029210292

@@ -10372,8 +10372,8 @@ AlterTSConfigurationStmt:
1037210372
;
1037310373

1037410374
/* Use this if TIME or ORDINALITY after WITH should be taken as an identifier */
10375-
any_with: WITH {}
10376-
| WITH_LA {}
10375+
any_with: WITH
10376+
| WITH_LA
1037710377
;
1037810378

1037910379

@@ -10520,8 +10520,8 @@ vac_analyze_option_list:
1052010520
;
1052110521

1052210522
analyze_keyword:
10523-
ANALYZE {}
10524-
| ANALYSE /* British */ {}
10523+
ANALYZE
10524+
| ANALYSE /* British */
1052510525
;
1052610526

1052710527
vac_analyze_option_elem:
@@ -11462,8 +11462,8 @@ OptTempTableName:
1146211462
}
1146311463
;
1146411464

11465-
opt_table: TABLE {}
11466-
| /*EMPTY*/ {}
11465+
opt_table: TABLE
11466+
| /*EMPTY*/
1146711467
;
1146811468

1146911469
all_or_distinct:
@@ -11481,8 +11481,8 @@ distinct_clause:
1148111481
;
1148211482

1148311483
opt_all_clause:
11484-
ALL { $$ = NIL;}
11485-
| /*EMPTY*/ { $$ = NIL; }
11484+
ALL
11485+
| /*EMPTY*/
1148611486
;
1148711487

1148811488
opt_sort_clause:
@@ -12086,15 +12086,15 @@ func_alias_clause:
1208612086
}
1208712087
;
1208812088

12089-
join_type: FULL join_outer { $$ = JOIN_FULL; }
12090-
| LEFT join_outer { $$ = JOIN_LEFT; }
12091-
| RIGHT join_outer { $$ = JOIN_RIGHT; }
12089+
join_type: FULL opt_outer { $$ = JOIN_FULL; }
12090+
| LEFT opt_outer { $$ = JOIN_LEFT; }
12091+
| RIGHT opt_outer { $$ = JOIN_RIGHT; }
1209212092
| INNER_P { $$ = JOIN_INNER; }
1209312093
;
1209412094

1209512095
/* OUTER is just noise... */
12096-
join_outer: OUTER_P { $$ = NULL; }
12097-
| /*EMPTY*/ { $$ = NULL; }
12096+
opt_outer: OUTER_P
12097+
| /*EMPTY*/
1209812098
;
1209912099

1210012100
/* JOIN qualification clauses

0 commit comments

Comments
 (0)