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

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



Rethink... the following fits better with the existing logic.

I wonder if that parenthesised group I've patched shouldn't say
  endchar != '"'
?  That looks neater and seems to pass the tests.

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:52:47 -0000
@@ -1567,7 +1567,8 @@ dquote_parse(char endchar, int sub)
 		err = (!brct-- && math);
 	    break;
 	case '"':
-	    if (intick || ((endchar == ']' || !endchar) && !bct))
+	    if (intick || ((endchar == ']' || endchar == ')' || !endchar) &&
+			   !bct))
 		break;
 	    if (bct) {
 		add(Dnull);
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:52:48 -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