zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: regurgitated case parentheses
       [not found] <1030204091832.ZM15610@candle.brasslantern.com>
@ 2003-02-04 11:15 ` Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2003-02-04 11:15 UTC (permalink / raw)
  To: Zsh hackers list

"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@csr.com>                  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.
**********************************************************************


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-04 11:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1030204091832.ZM15610@candle.brasslantern.com>
2003-02-04 11:15 ` PATCH: regurgitated case parentheses Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).