Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: pws-19: minor syntactic innovation



Just thought of a trivial way to take a lot of grief out of parameter
substitution.  This patch makes the following valid:

  ${${${${(f)"$(typeset)"}:#*local *\=*}%%\=*}##* }

replacing the equivalent but grotesquer

  "${(@)${(@)${(@)${(@f)$(typeset)}:#*local *\=*}%%\=*}##* }"

Since you got nothing when you did that before, I don't see how it can
break anything.  The key point is that quotation of a substitution is
already tested for by looking at whether it begins with a quoted $, not by
whether the parent substitution is quoted.

--- Src/subst.c.qt	Fri May 21 09:14:43 1999
+++ Src/subst.c	Sun May 23 17:07:33 1999
@@ -976,7 +976,9 @@
 		zerr("bad substitution", NULL, 0);
 		return NULL;
 	    }
-	} else
+	} else if (INULL(*s))
+	    s++;
+	else
 	    break;
     }
     globsubst = globsubst && !qt;
@@ -999,6 +1001,8 @@
 	    idbeg = val;
 	copied = 1;
 	*s = sav;
+	while (INULL(*s))
+	    s++;
 	v = (Value) NULL;
     } else if (aspar) {
 	if ((v = getvalue(&s, 1))) {

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author