pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Michael Paquier <michael.paquier@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-committers@postgresql.org
Subject: Re: pgsql: Run the C portions of guc-file.l through pgindent.
Date: Mon, 29 Jun 2015 10:02:32 -0400
Message-ID: <55914FF8.80108@dunslane.net> (raw)
In-Reply-To: <CAB7nPqQHDOx9-pnPwLQfcbD42=efFthCvP_mKVyCzP0BMaeT8Q@mail.gmail.com>
References: <E1Z9NGX-0002ot-7c@gemulon.postgresql.org>
	<CAB7nPqQHDOx9-pnPwLQfcbD42=efFthCvP_mKVyCzP0BMaeT8Q@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>


On 06/28/2015 09:24 PM, Michael Paquier wrote:
> On Mon, Jun 29, 2015 at 9:49 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Run the C portions of guc-file.l through pgindent.
>>
>> Yeah, I know, pretty anal-retentive of me.  But we oughta find some
>> way to automate this for the .y and .l files.
> .y files may be tricky and .l files less. Still one good way to test
> such things would be to use something like that and see at least what
> happens when doing a run (haven't tested, use at your own risk):
> diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
> index 0d3859d..3995214 100755
> --- a/src/tools/pgindent/pgindent
> +++ b/src/tools/pgindent/pgindent
> @@ -519,6 +519,7 @@ File::Find::find(
>                          (($dev, $ino, $mode, $nlink, $uid, $gid) = lstat($_))
>                            && -f _
>                            && /^.*\.[ch]\z/s
> +                         && /^.*\.(h|c|y|l)\z/s
>                            && push(@files, $File::Find::name);
>                    }
>          },
>
> Regards,

Try it and see. I would expect it to blow up badly. It should be 
possible to teach pgindent to extract the C portions of the files, 
indent them and then replace them. Of course, especially in the case of 
.y files, that would exclude almost all of the files in many cases.

cheers

andrew



-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



view thread (3+ messages)

Message-ID: <55914FF8.80108@dunslane.net>
Permalink:  ../55914FF8.80108@dunslane.net/
Also on:    postgresql.org/message-id/55914FF8.80108@dunslane.net

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andrew@dunslane.net, michael.paquier@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Run the C portions of guc-file.l through pgindent.
  In-Reply-To: <55914FF8.80108@dunslane.net>
  References: <E1Z9NGX-0002ot-7c@gemulon.postgresql.org> <CAB7nPqQHDOx9-pnPwLQfcbD42=efFthCvP_mKVyCzP0BMaeT8Q@mail.gmail.com> <55914FF8.80108@dunslane.net>

* 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