Thread

Commits

  1. Use named captures in Catalog::ParseHeader()

  1. [PATCH] Using named captures in Catalog::ParseHeader()

    Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> — 2023-06-01T12:12:22Z

    Hi Hackers,
    
    Peter's patch set for autogenerating syscache info
    (https://postgr.es/m/75ae5875-3abc-dafc-8aec-73247ed41cde%40eisentraut.org)
    touched on one of my least favourite parts of Catalog.pm: the
    parenthesis-counting nightmare that is the parsing of catalog header
    directives.
    
    However, now that we require Perl 5.14, we can use the named capture
    feature (introduced in Perl 5.10) to make that a lot clearer, as in the
    attached patch.
    
    While I was rewriting the regexes I noticed that they were inconsistent
    about whether they accepted whitespace in the parameter lists, so I took
    the liberty to make them consistently allow whitespace after the opening
    paren and the commas, which is what most of them already did.
    
    I've verified that the generated postgres.bki is identical to before,
    and all tests pass.
    
    - ilmari
    
    
  2. Re: [PATCH] Using named captures in Catalog::ParseHeader()

    John Naylor <john.naylor@enterprisedb.com> — 2023-06-13T10:50:10Z

    On Thu, Jun 1, 2023 at 7:12 PM Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
    wrote:
    >
    > Hi Hackers,
    >
    > Peter's patch set for autogenerating syscache info
    > (https://postgr.es/m/75ae5875-3abc-dafc-8aec-73247ed41cde%40eisentraut.org
    )
    > touched on one of my least favourite parts of Catalog.pm: the
    > parenthesis-counting nightmare that is the parsing of catalog header
    > directives.
    >
    > However, now that we require Perl 5.14, we can use the named capture
    > feature (introduced in Perl 5.10) to make that a lot clearer, as in the
    > attached patch.
    >
    > While I was rewriting the regexes I noticed that they were inconsistent
    > about whether they accepted whitespace in the parameter lists, so I took
    > the liberty to make them consistently allow whitespace after the opening
    > paren and the commas, which is what most of them already did.
    
    LGTM
    
    --
    John Naylor
    EDB: http://www.enterprisedb.com
    
  3. Re: [PATCH] Using named captures in Catalog::ParseHeader()

    Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> — 2023-06-13T15:14:27Z

    Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> writes:
    
    > However, now that we require Perl 5.14, we can use the named capture
    > feature (introduced in Perl 5.10) to make that a lot clearer, as in the
    > attached patch.
    
    Added to the open commitfest: https://commitfest.postgresql.org/43/4361/
    
    - ilmari
    
    
    
    
  4. Re: [PATCH] Using named captures in Catalog::ParseHeader()

    Michael Paquier <michael@paquier.xyz> — 2023-06-14T01:03:24Z

    On Thu, Jun 01, 2023 at 01:12:22PM +0100, Dagfinn Ilmari Mannsåker wrote:
    > While I was rewriting the regexes I noticed that they were inconsistent
    > about whether they accepted whitespace in the parameter lists, so I took
    > the liberty to make them consistently allow whitespace after the opening
    > paren and the commas, which is what most of them already did.
    
    That's the business with \s* in CATALOG.  Is that right?  Indeed,
    that's more consistent.
    
    > I've verified that the generated postgres.bki is identical to before,
    > and all tests pass.
    
    I find that pretty cool.  Nice.  Patch looks OK from here.
    --
    Michael
    
  5. Re: [PATCH] Using named captures in Catalog::ParseHeader()

    Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> — 2023-06-14T09:30:23Z

    Michael Paquier <michael@paquier.xyz> writes:
    
    > On Thu, Jun 01, 2023 at 01:12:22PM +0100, Dagfinn Ilmari Mannsåker wrote:
    >> While I was rewriting the regexes I noticed that they were inconsistent
    >> about whether they accepted whitespace in the parameter lists, so I took
    >> the liberty to make them consistently allow whitespace after the opening
    >> paren and the commas, which is what most of them already did.
    >
    > That's the business with \s* in CATALOG.  Is that right?  Indeed,
    > that's more consistent.
    
    Yes, \s* means "zero or more whitespace characters".
    
    >> I've verified that the generated postgres.bki is identical to before,
    >> and all tests pass.
    >
    > I find that pretty cool.  Nice.  Patch looks OK from here.
    
    Thanks for the review!
    
    - ilmari
    
    
    
    
  6. Re: [PATCH] Using named captures in Catalog::ParseHeader()

    Michael Paquier <michael@paquier.xyz> — 2023-06-30T00:26:51Z

    On Wed, Jun 14, 2023 at 10:30:23AM +0100, Dagfinn Ilmari Mannsåker wrote:
    > Thanks for the review!
    
    v17 is now open, so applied this one.
    --
    Michael
    
  7. Re: [PATCH] Using named captures in Catalog::ParseHeader()

    Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> — 2023-06-30T09:34:08Z

    Michael Paquier <michael@paquier.xyz> writes:
    
    > On Wed, Jun 14, 2023 at 10:30:23AM +0100, Dagfinn Ilmari Mannsåker wrote:
    >> Thanks for the review!
    >
    > v17 is now open, so applied this one.
    
    Thanks for committing!
    
    - ilmari