diff options
| author | tjg <tjg> | 2001-10-03 12:41:38 +0000 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:23:19 +0100 |
| commit | da5e3263a66be23102fd988e1bb51a152d1869dd (patch) | |
| tree | adfc2f596f97157292fc4609590429a4ee95d1f1 | |
| parent | a11a8d312e531231ed4d284f3cd129ccf2de2a43 (diff) | |
Feature: exported lists no longer use redundant parentheses.
| -rw-r--r-- | footobar.c | 12 | ||||
| -rw-r--r-- | rc.1 | 14 |
2 files changed, 23 insertions, 3 deletions
@@ -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; @@ -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 |