Re: backslashes in pgindent

From: "Luke Lonergan" <llonergan(at)greenplum(dot)com>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "PostgreSQL-patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: backslashes in pgindent
Date: 2005-07-16 04:45:05
Message-ID: BEFDDEE1.8C08%llonergan@greenplum.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Bruce,
> I found that parentheses in gawk regular expressions require backslashes
> so they are not treated as regex groupings:
>
> $ echo '('|awk '$0 ~ /(/ {print $0}'
> awk: cmd. line:1: fatal: Unmatched ( or \(: /(/
> $ echo '('|awk '$0 ~ /\(/ {print $0}'
> (


> Now, it seems closing parentheses are OK because there is no open group,
> but I think I should use backslashes there too:
>
> $ echo ')'|awk '$0 ~ /)/ {print $0}'
> )
> $ echo ')'|awk '$0 ~ /\)/ {print $0}'
>
> Does your awk produce different results? What version is it? Mine is GNU Awk
> 3.0.6.

Yes - on the last test, mine emits the ")" and yours apparently does not.
The version I ran with is 3.1.4.

The escaped parenthesis in the unpatched pgindent causes the following
warning:

$ pgindent test.c
Hope you installed /src/tools/pgindent/indent.bsd.patch.
awk: cmd. line:12: warning: escape sequence `\)' treated as plain `)'

Which implies an unnecessary escaping, which appears to function correctly
without the escape.

Cheers,

- Luke

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-07-16 04:59:16 Re: backslashes in pgindent
Previous Message Kris Jurka 2005-07-16 01:06:15 Re: 4 pgcrypto regressions failures - 1 unsolved