Clean up optional rules in grammar

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Clean up optional rules in grammar
Date: 2020-11-11 09:12:50
Message-ID: e9eed669-e32d-6919-fed4-acc0daea857b@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

There are a number of rules like this in the grammar:

opt_foo: FOO
| /*EMPTY*/
;

And there are some like this:

opt_foo: FOO {}
| /*EMPTY*/ {}
;

and some even like this:

%type <node> opt_foo

opt_foo: FOO { $$ = NULL; }
| /*EMPTY*/ { $$ = NULL; }
;

(I mean here specifically those rules where FOO is a noise word and the
actions are the same in each branch.)

It's obviously confusing to have multiple different styles to do the
same thing. And these extra rules (including the empty ones) also end
up in the output, so they create more work down the line.

The attached patch cleans this up to make them all look like the first
style.

Attachment Content-Type Size
0001-Clean-up-optional-rules-in-grammar.patch text/plain 5.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message tsunakawa.takay@fujitsu.com 2020-11-11 09:24:48 RE: Disable WAL logging to speed up data loading
Previous Message Simon Riggs 2020-11-11 08:57:15 Re: Background writer and checkpointer in crash recovery