Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcoXT-0002XH-3o for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Nov 2020 11:43:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kcoXS-00027O-1p for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Nov 2020 11:43:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcoXR-00027F-RA for pgsql-hackers@lists.postgresql.org; Wed, 11 Nov 2020 11:43:45 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcoXP-00014K-K7 for pgsql-hackers@postgresql.org; Wed, 11 Nov 2020 11:43:45 +0000 X-Originating-IP: 79.88.149.14 Received: from [172.16.255.146] (14.149.88.79.rev.sfr.net [79.88.149.14]) (Authenticated sender: vik@postgresfriends.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 04B93E0002; Wed, 11 Nov 2020 11:43:40 +0000 (UTC) Subject: Re: Clean up optional rules in grammar To: Peter Eisentraut , pgsql-hackers References: From: Vik Fearing Message-ID: <0e608c89-3b1d-1dbf-7c03-423f15dcbbed@postgresfriends.org> Date: Wed, 11 Nov 2020 12:43:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 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