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

Re: Quoted parameter parsing glitch



On Aug 22, 10:25pm, Borsenkow Andrej wrote:
}
} As I said - they must match. "${foo:-""}" is valid but "${foo:-"}" - not.

The question is whether "${foo:-"}"}" is valid.

Also, the PS2 prompt doesn't know about nested double quotes.  This is
probably what had me confused before:

schaefer<502> echo "${foo:-"}
dquote braceparam> 

Note that the prompt indicates that `}"' will end the quoting scope, but
in fact you need `"}"'.  The prompt should say

dquote braceparam dquote>

and does with the patch below.

Index: Src/lex.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/lex.c,v
retrieving revision 1.3
diff -c -r1.3 lex.c
--- Src/lex.c	2001/04/23 15:35:41	1.3
+++ Src/lex.c	2001/08/26 17:22:15
@@ -1395,7 +1395,9 @@
 		break;
 	    if (bct) {
 		add(Dnull);
+		cmdpush(CS_DQUOTE);
 		err = dquote_parse('"', sub);
+		cmdpop();
 		c = Dnull;
 	    } else
 		err = 1;

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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