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

PATCH: regurgitated case parentheses



"Bart Schaefer" wrote:
> Just watch out for what happens if you ever have unbalanced parentheses in
> the content of the here-document.

Apropos of which, I've been thinking for a while that

% fn() { case foo in (bar) print yes;; ((a|b)) print no;; esac; }
% functions fn
fn () {
        case foo in
                bar) print yes ;;
                (a|b)) print no ;;
        esac
}

is suboptimal.  The following patch puts in a balanced leading
parenthesis.

Index: Src/text.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/text.c,v
retrieving revision 1.12
diff -u -r1.12 text.c
--- Src/text.c	13 Nov 2002 21:09:07 -0000	1.12
+++ Src/text.c	4 Feb 2003 11:14:37 -0000
@@ -521,6 +521,7 @@
 			taddnl();
 		    else
 			taddchr(' ');
+		    taddstr("(");
 		    code = *state->pc++;
 		    taddstr(ecgetstr(state, EC_NODUP, NULL));
 		    state->pc++;
@@ -537,6 +538,7 @@
 		    taddnl();
 		else
 		    taddchr(' ');
+		taddstr("(");
 		code = *state->pc++;
 		taddstr(ecgetstr(state, EC_NODUP, NULL));
 		state->pc++;

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



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