Re: backslashes in pgindent

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: backslashes in pgindent
Дата
Msg-id 200507160459.j6G4xGq24356@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: backslashes in pgindent  ("Luke Lonergan" <llonergan@greenplum.com>)
Ответы Re: backslashes in pgindent
Список pgsql-patches
Luke Lonergan wrote:
> 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.

Actually, mine returns ')' too for the last command.   I didn't copy
that into the email.  How about the top tests?  Notice I get an error on
the first one without the backslash.  Are you OK escaping '(' but not
')'?  That might be a solution.

> 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
>
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

В списке pgsql-patches по дате отправления:

Предыдущее
От: "Luke Lonergan"
Дата:
Сообщение: Re: backslashes in pgindent
Следующее
От: "Luke Lonergan"
Дата:
Сообщение: Re: backslashes in pgindent