zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@math.gatech.edu
Subject: Re: cshjunkieparen bothers me (and always has)
Date: Mon, 1 Jul 1996 12:19:11 -0700	[thread overview]
Message-ID: <960701121913.ZM617@candle.brasslantern.com> (raw)
In-Reply-To: "Bart Schaefer" <schaefer@candle.brasslantern.com> "cshjunkieparen bothers me (and always has)" (Jun 30, 12:19am)

On Jun 30, 12:19am, Bart Schaefer wrote:
} Subject: cshjunkieparen bothers me (and always has)
}
} I'm having a really hard time figuring out why zsh can't simply support the
} `if ( ... ) { ... }' and `if [[ ... ]] { ... }' syntax all the time, and
} always have `( ... )' mean a subshell even with that syntax; and then get
} rid of the cshjunkieparen option.
} 
} If we really wanted a cshjunkieparen that meant something useful, it would
} mean that the parens were interpreted as [[ ... ]] like so:
} 
} 	if ( $TERM == xterm ) then
} 	    ...
} 	fi
} 
} I certainly wouldn't object to that -- though you'd probably have to call
} the option `cshjunkietests' now because cshjunkieparen is tainted.
} 
} I'm not suggesting that cshjunkietests be added to 3.0.0.  However, I *AM*
} suggesting that cshjunkieparen be removed in favor of always supporting
} the associated syntax.

Here's a patch that does just that -- removes cshjunkieparen, leaving the
associated syntax supported.  This patch also includes, but comments out,
the code to implement cshjunkietests.

No man page patch here, as I'm offering this only for consideration at
this point.

diff -c zsh-3.0-pre1/Src/globals.h zsh-3.0-pre1-work/Src/globals.h
*** zsh-3.0-pre1/Src/globals.h	Fri Jun 28 06:43:49 1996
--- zsh-3.0-pre1-work/Src/globals.h	Mon Jul  1 12:02:40 1996
***************
*** 648,654 ****
      {"correctall", 		'O', 0,   0},
      {"cshjunkiehistory", 	0,   0,   OPT_EMULATE|OPT_CSH},
      {"cshjunkieloops", 		0,   0,   OPT_EMULATE|OPT_CSH},
!     {"cshjunkieparen", 		0,   0,   OPT_EMULATE|OPT_CSH},
      {"cshjunkiequotes", 	0,   0,   OPT_EMULATE|OPT_CSH},
      {"cshnullglob", 		0,   0,   OPT_EMULATE|OPT_CSH},
      {"errexit", 		'e', 'e', 0},
--- 648,654 ----
      {"correctall", 		'O', 0,   0},
      {"cshjunkiehistory", 	0,   0,   OPT_EMULATE|OPT_CSH},
      {"cshjunkieloops", 		0,   0,   OPT_EMULATE|OPT_CSH},
! /*  {"cshjunkietests", 		0,   0,   OPT_EMULATE|OPT_CSH}, */
      {"cshjunkiequotes", 	0,   0,   OPT_EMULATE|OPT_CSH},
      {"cshnullglob", 		0,   0,   OPT_EMULATE|OPT_CSH},
      {"errexit", 		'e', 'e', 0},
diff -c zsh-3.0-pre1/Src/parse.c zsh-3.0-pre1-work/Src/parse.c
*** zsh-3.0-pre1/Src/parse.c	Fri Jun 28 06:43:50 1996
--- zsh-3.0-pre1-work/Src/parse.c	Mon Jul  1 12:03:32 1996
***************
*** 412,418 ****
  	c->args = par_wordlist();
  	if (tok != SEPER)
  	    YYERRORV;
!     } else if (tok == INPAR && (csh || isset(CSHJUNKIEPAREN))) {
  	f->inflag = 1;
  	incmdpos = 0;
  	yylex();
--- 412,418 ----
  	c->args = par_wordlist();
  	if (tok != SEPER)
  	    YYERRORV;
!     } else if (tok == INPAR) {
  	f->inflag = 1;
  	incmdpos = 0;
  	yylex();
***************
*** 599,620 ****
  	    cmdpop();
  	    YYERRORV;
  	}
! 	if (tok == INPAR && isset(CSHJUNKIEPAREN)) {
! 	    yylex();
! 	    l = par_list();
! 	    if (tok != OUTPAR) {
! 		cmdpop();
! 		YYERRORV;
! 	    }
! 	    addlinknode(ifsl, l);
! 	    ni++;
! 	    incmdpos = 1;
! 	    yylex();
! 	} else {
! 	    addlinknode(ifsl, par_list());
! 	    ni++;
! 	    incmdpos = 1;
! 	}
  	while (tok == SEPER)
  	    yylex();
  	xtok = FI;
--- 599,611 ----
  	    cmdpop();
  	    YYERRORV;
  	}
! /*
! 	if (tok == INPAR && isset(CSHJUNKIETESTS))
! 	    tok = DINBRACK;
! */
! 	addlinknode(ifsl, par_list());
! 	ni++;
! 	incmdpos = 1;
  	while (tok == SEPER)
  	    yylex();
  	xtok = FI;
***************
*** 627,633 ****
  	    nt++;
  	    incmdpos = 1;
  	    cmdpop();
! 	} else if (isset(CSHJUNKIEPAREN)) {
  	    if (tok == INBRACE) {
  		cmdpop();
  		cmdpush(nc);
--- 618,624 ----
  	    nt++;
  	    incmdpos = 1;
  	    cmdpop();
! 	} else {
  	    if (tok == INBRACE) {
  		cmdpop();
  		cmdpush(nc);
***************
*** 655,663 ****
  		incmdpos = 1;
  		break;
  	    }
- 	} else {
- 	    cmdpop();
- 	    YYERRORV;
  	}
      }
      cmdpop();
--- 646,651 ----
***************
*** 665,690 ****
  	cmdpush(CS_ELSE);
  	while (tok == SEPER)
  	    yylex();
! 	if (isset(CSHJUNKIEPAREN) && tok == INBRACE) {
! 	    yylex();
! 	    l = par_list();
! 	    if (tok != OUTBRACE) {
! 		cmdpop();
! 		YYERRORV;
! 	    }
! 	    addlinknode(thensl, l);
! 	    nt++;
! 	    yylex();
! 	} else {
! 	    l = par_list();
! 	    if (tok != FI) {
! 		cmdpop();
! 		YYERRORV;
! 	    }
! 	    addlinknode(thensl, l);
! 	    nt++;
! 	    yylex();
  	}
  	cmdpop();
      }
      i = (struct ifcmd *)make_ifcmd();
--- 653,666 ----
  	cmdpush(CS_ELSE);
  	while (tok == SEPER)
  	    yylex();
! 	l = par_list();
! 	if (tok != FI) {
! 	    cmdpop();
! 	    YYERRORV;
  	}
+ 	addlinknode(thensl, l);
+ 	nt++;
+ 	yylex();
  	cmdpop();
      }
      i = (struct ifcmd *)make_ifcmd();
***************
*** 718,732 ****
      w = c->u.whilecmd = (struct whilecmd *)make_whilecmd();
      w->cond = (tok == UNTIL);
      yylex();
!     if (tok == INPAR && isset(CSHJUNKIEPAREN)) {
! 	yylex();
! 	w->cont = par_list();
! 	if (tok != OUTPAR)
! 	    YYERRORV;
! 	yylex();
!     } else {
! 	w->cont = par_list();
!     }
      incmdpos = 1;
      while (tok == SEPER)
  	yylex();
--- 694,704 ----
      w = c->u.whilecmd = (struct whilecmd *)make_whilecmd();
      w->cond = (tok == UNTIL);
      yylex();
! /*
!     if (tok == INPAR && isset(CSHJUNKIETESTS))
! 	tok = DINBRACK;
! */
!     w->cont = par_list();
      incmdpos = 1;
      while (tok == SEPER)
  	yylex();
***************
*** 863,868 ****
--- 835,844 ----
      incmdpos = 0;
      yylex();
      c->u.cond = par_cond();
+ /*
+     if (isset(CSHJUNKIETESTS) && tok == OUTPAR)
+ 	tok = DOUTBRACK;
+ */
      if (tok != DOUTBRACK)
  	YYERRORV;
      incond = 0;
diff -c zsh-3.0-pre1/Src/zsh.h zsh-3.0-pre1-work/Src/zsh.h
*** zsh-3.0-pre1/Src/zsh.h	Fri Jun 28 06:43:52 1996
--- zsh-3.0-pre1-work/Src/zsh.h	Mon Jul  1 12:03:15 1996
***************
*** 1037,1043 ****
      CORRECTALL,
      CSHJUNKIEHISTORY,
      CSHJUNKIELOOPS,
!     CSHJUNKIEPAREN,
      CSHJUNKIEQUOTES,
      CSHNULLGLOB,
      ERREXIT,
--- 1037,1043 ----
      CORRECTALL,
      CSHJUNKIEHISTORY,
      CSHJUNKIELOOPS,
! /*  CSHJUNKIETESTS, */
      CSHJUNKIEQUOTES,
      CSHNULLGLOB,
      ERREXIT,

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



  reply	other threads:[~1996-07-01 19:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-30  7:19 Bart Schaefer
1996-07-01 19:19 ` Bart Schaefer [this message]
1996-07-01 21:02   ` Zoltan Hidvegi
1996-07-01 21:35     ` Anthony Heading
1996-07-02  1:03       ` Bart Schaefer
1996-07-02  8:48   ` Peter Stephenson
1996-07-02 19:35     ` Bart Schaefer
1996-07-04 13:14       ` Zoltan Hidvegi
1996-07-04 15:58         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=960701121913.ZM617@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=schaefer@nbn.com \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).