[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] pretty-print eats header comments
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] pretty-print eats header comments |
Date: |
Thu, 15 Jan 2015 05:59:39 +0200 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
Hi.
Sorry for the delay in replying.
I've asked my team member who did this work to look at this.
In general, getting the comments right is a hard problem, since
comments don't really exist in the grammar. We've done the best we
can, but it may not be solvable in a way that gets things completely
right every time.
Thanks,
Arnold
> Date: Fri, 02 Jan 2015 08:24:03 -0200
> From: Hermann Peifer <address@hidden>
> To: address@hidden
> Subject: Re: [bug-gawk] pretty-print eats header comments
>
> On 2014-12-31 15:44, Hermann Peifer wrote:
> >
> > Thanks for taking care. I upudated from git master and noted that pretty
> > printing works much better now.
> >
>
> I now noted that a comment from the END rule is moved to the top, which
> is somewhat surprising. See below.
>
> Hermann
>
> $ cat test.awk
> # Some
> # header
> # comments
>
> # Add up
> { sum += $1 }
>
> # Print sum
> END { print sum }
>
> $ awk -o/dev/stdout -f test.awk
> # Print sum
> # Some
> # header
> # comments
>
> # Add up
> {
> sum += $1
> }
>
> END {
> print sum
> }
>