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

Re: \" in $(( )) vs $[ ]



On Thu, 15 Sep 2011 12:17:44 +0200
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> % echo $(( ##\" ))
> <cmdsubst:~>%

At this point we haven't resolved between $((...)...) and $((...)), but
I don't think double quote needs to be handled differently in the two
cases.

Index: Src/lex.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/lex.c,v
retrieving revision 1.67
diff -p -u -r1.67 lex.c
--- Src/lex.c	19 Jun 2011 16:26:11 -0000	1.67
+++ Src/lex.c	15 Sep 2011 12:09:27 -0000
@@ -1482,7 +1482,8 @@ dquote_parse(char endchar, int sub)
 		    (endchar == ']' && (c == '[' || c == ']' ||
 					c == '(' || c == ')' ||
 					c == '{' || c == '}' ||
-					(c == '"' && sub))))
+					(c == '"' && sub))) ||
+		    (endchar == ')' && c == '"'))
 		    add(Bnull);
 		else {
 		    /* lexstop is implicitly handled here */
Index: Test/D08cmdsubst.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/D08cmdsubst.ztst,v
retrieving revision 1.4
diff -p -u -r1.4 D08cmdsubst.ztst
--- Test/D08cmdsubst.ztst	11 Jul 2009 16:43:01 -0000	1.4
+++ Test/D08cmdsubst.ztst	15 Sep 2011 12:09:28 -0000
@@ -98,3 +98,11 @@
  echo `echo $?`
 0:Non-empty command substitution inherits status
 >1
+
+ echo $(( ##\" ))
+ echo $(echo \")
+ echo $((echo \"); echo OK)
+0:Handling of backslash double quote in parenthesised substitutions
+>34
+>"
+>" OK

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog



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