From: Vik Fearing <vik@postgresfriends.org>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Clean up optional rules in grammar
Date: Wed, 11 Nov 2020 12:43:40 +0100
Message-ID: <0e608c89-3b1d-1dbf-7c03-423f15dcbbed@postgresfriends.org> (raw)
In-Reply-To: <e9eed669-e32d-6919-fed4-acc0daea857b@enterprisedb.com>
References: <e9eed669-e32d-6919-fed4-acc0daea857b@enterprisedb.com>
On 11/11/20 10:12 AM, Peter Eisentraut wrote:
> 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.
No objections, but could we also take this opportunity to standardize
the comment itself? Even in your patch there is a mix of spacing and
casing.
My preference is /* EMPTY */. That is, uppercase with spaces, but
whatever gets chosen is fine with me.
--
Vik Fearing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: vik@postgresfriends.org, peter.eisentraut@enterprisedb.com
Subject: Re: Clean up optional rules in grammar
In-Reply-To: <0e608c89-3b1d-1dbf-7c03-423f15dcbbed@postgresfriends.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox