bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No form commsub if last token ends with & or ;


From: alex xmb ratchev
Subject: Re: No form commsub if last token ends with & or ;
Date: Wed, 21 Jun 2023 00:14:16 +0200

On Mon, Jun 19, 2023, 20:16 Chet Ramey <chet.ramey@case.edu> wrote:

> On 6/18/23 4:59 AM, Grisha Levit wrote:
> > On Sunday, May 28, 2023, Grisha Levit <grishalevit@gmail.com> wrote:
> >
> >> Missing final `;':
> >>
> >> "$BASH" --pretty-print <<< $'${ : \;;}'
> >> ${ : \; }
> >>
> >
> > The latest set of fixes to this code solves these cases but others  have
> > issues:
> >
> > $ bash --pretty-print <<<$'${ : \;;\n}'
> > ${ : \; }
> > $ bash --pretty-print <<<$'${ : \;\n\n}'
> > ${ : \; }
> > $ bash --pretty-print <<<$'${ : \&;\n}'
> > ${ : \& }
> > $ bash --pretty-print <<<$'${ : \&;\n\n}'
> > ${ : \& }
> >
> > I think it might be ok to just have print_comsub handle adding the final
> > semicolon when needed instead of trying to add it after the fact in
> > parse_comsub?
>
> I'll think about it. The advantage of doing it in parse_comsub is that
> the parser has access to the token history, instead of having to intuit
> it lexically. Along the lines of what Martin Kealey said, it's easy to
> output a newline if the last token the parser read before the closing `}'
> was a newline, and that solves this problem.
>

if u wanna .. keep users newspaces and stuff
like some 1 : 1 code print , u d just need to save the text/data between
keywords
thats not pretty print ..

awk has it , or gawk , with split and patsplit , saves the 'in between' in
an arr ( seps )
sadly this important pieces didnt make it to without function calling

-- 
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]