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.
--
``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/