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

Re: Arithmetic expression (bug?)



On Nov 4,  9:34pm, Phil Pennock wrote:
} Subject: Arithmetic expression (bug?)
}
} -----------------------------< cut here >-------------------------------
} foo=alpha
} print -- ${(l<$[10]><x>)foo}
} print -- ${(l<10><x>)foo}
} -----------------------------< cut here >-------------------------------
} why does the third line produce:
} ./testfile: error in flags [3]
} ?

Having just said I wasn't sure how to fix this, here's a patch that takes
care of it.  I'm still not sure it's the *best* patch for it ....

Index: Src/subst.c
===================================================================
--- subst.c	1998/11/12 09:21:35	1.2
+++ subst.c	1998/11/15 22:27:52
@@ -743,6 +743,7 @@
 	    long num;
 	    int escapes = 0;
 	    int klen;
+#define UNTOK(C)  (itok(C) ? ztokens[(C) - Pound] : (C))
 #define UNTOK_AND_ESCAPE(X) {\
 		untokenize(X = dupstring(s + 1));\
 		if (escapes) {\
@@ -856,7 +857,7 @@
 			prenum = num;
 		    else
 			postnum = num;
-		    if (s[1] != sav)
+		    if (UNTOK(s[1]) != UNTOK(sav))
 			break;
 		    t = get_strarg(++s);
 		    if (!*t)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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