| From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
|---|---|
| To: | llonergan(at)greenplum(dot)com |
| Cc: | PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org> |
| Subject: | backslashes in pgindent |
| Date: | 2005-07-13 03:59:57 |
| Message-ID: | 200507130359.j6D3xv611312@candle.pha.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-patches |
Luke, I have had to back out the removal of backslashes in the pgindent
awk script. Your patch was to remove them:
line1 !~ "^typedef" &&
line1 !~ "^extern[ ][ ]*\"C\"" &&
line1 !~ "=" &&
! line1 ~ "\)")
print "int pgindent_func_no_var_fix;";
line1 = line2;
}
--- 56,62 ----
line1 !~ "^typedef" &&
line1 !~ "^extern[ ][ ]*\"C\"" &&
line1 !~ "=" &&
! line1 ~ ")")
print "int pgindent_func_no_var_fix;";
line1 = line2;
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.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
| Attachment | Content-Type | Size |
|---|---|---|
| unknown_filename | text/plain | 2.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2005-07-13 04:22:42 | Re: Doc patch: New PL/Perl Features |
| Previous Message | Bruce Momjian | 2005-07-13 02:31:00 | Re: [PATCHES] thousands comma numeric formatting in psql |