commit da5e3263a66be23102fd988e1bb51a152d1869dd
parent a11a8d312e531231ed4d284f3cd129ccf2de2a43
Author: tjg <tjg>
Date: Wed, 3 Oct 2001 12:41:38 +0000
Feature: exported lists no longer use redundant parentheses.
Diffstat:
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/footobar.c b/footobar.c
@@ -70,12 +70,22 @@ static bool Tconv(Format *f, int ignore) {
case nSwitch: fmtprint(f, "switch(%T){%T}", n->u[0].p, n->u[1].p); break;
case nMatch: fmtprint(f, "~ %T %T", n->u[0].p, n->u[1].p); break;
case nWhile: fmtprint(f, "while(%T)%T", n->u[0].p, n->u[1].p); break;
- case nLappend: fmtprint(f, "(%T %T)", n->u[0].p, n->u[1].p); break;
case nForin: fmtprint(f, "for(%T in %T)%T", n->u[0].p, n->u[1].p, n->u[2].p); break;
case nVarsub: fmtprint(f, "$%T(%T)", n->u[0].p, n->u[1].p); break;
case nWord:
fmtprint(f, quotep(n->u[0].s, dollar) ? "%#S" : "%S", n->u[0].s);
break;
+ case nLappend: {
+ static bool inlist;
+ if (!inlist) {
+ inlist = TRUE;
+ fmtprint(f, "(%T %T)", n->u[0].p, n->u[1].p);
+ inlist = FALSE;
+ } else {
+ fmtprint(f, "%T %T", n->u[0].p, n->u[1].p);
+ }
+ break;
+ }
case nCount: case nFlat: case nVar: {
char *lp = "", *rp = "";
Node *n0 = n->u[0].p;
diff --git a/rc.1 b/rc.1
@@ -1933,8 +1933,6 @@ The
notation for flattening should allow for using an arbitrary
separating character, not just space.
.PP
-List definitions in exported functions are "noisier" than they need to be.
-.PP
If both
.Cr $PATH
and
@@ -1958,8 +1956,20 @@ code is illegal.
.Ds
.Cr "while ((~ $1 -*) && (! ~ $1 --)) { ..."
.De
+.TP
The redundant inner parentheses must be omitted.
.PP
+Semantic errors (e.g. "bad concatenation") in
+.B fn prompt
+are not handled elegantly. For example,
+.Ds
+.Cr "fn prompt { echo (a b)^(c d e) }"
+.De
+.TP
+throws
+.I rc
+into a tailspin.
+.PP
Bug reports should be mailed to
.Cr "<tjg@star.le.ac.uk>" .
.SH INCOMPATIBILITIES