zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: schaefer@nbn.com
Cc: mliggett@pobox.com, zsh-workers@math.gatech.edu
Subject: Re: bug in 3.0.0?
Date: Thu, 22 Aug 1996 23:10:11 +0200 (MET DST)	[thread overview]
Message-ID: <199608222110.XAA16315@bolyai.cs.elte.hu> (raw)
In-Reply-To: <960821121437.ZM11481@candle.brasslantern.com> from Bart Schaefer at "Aug 21, 96 12:14:37 pm"

> The problem is with "else { ... }".  3.0 wants a "fi" at the end of the
> if/elif/else chain, even when using the { ... } form -- but only when
> it ends with "else { ... }".
> 
> This seems to fix it.

That breaks

if ... ; then ... ; else { ... } ; ... fi

The patch below is a slighly modified version of Bart's patch.

Zoltan


*** Src/parse.c	1996/08/14 16:48:19	2.25
--- Src/parse.c	1996/08/22 21:07:43
***************
*** 605,611 ****
      unsigned char nc;
      LinkList ifsl, thensl;
      LinkNode no;
!     int ni = 0, nt = 0;
      List l, *ll;
  
      ifsl = newlinklist();
--- 605,611 ----
      unsigned char nc;
      LinkList ifsl, thensl;
      LinkNode no;
!     int ni = 0, nt = 0, usebrace = 0;
      List l, *ll;
  
      ifsl = newlinklist();
***************
*** 634,639 ****
--- 634,640 ----
  	xtok = FI;
  	nc = cmdstack[cmdsp - 1] == CS_IF ? CS_IFTHEN : CS_ELIFTHEN;
  	if (tok == THEN) {
+ 	    usebrace = 0;
  	    cmdpop();
  	    cmdpush(nc);
  	    yylex();
***************
*** 643,648 ****
--- 644,650 ----
  	    cmdpop();
  	} else {
  	    if (tok == INBRACE) {
+ 		usebrace = 1;
  		cmdpop();
  		cmdpush(nc);
  		yylex();
***************
*** 676,685 ****
  	cmdpush(CS_ELSE);
  	while (tok == SEPER)
  	    yylex();
! 	l = par_list();
! 	if (tok != FI) {
! 	    cmdpop();
! 	    YYERRORV;
  	}
  	addlinknode(thensl, l);
  	nt++;
--- 678,696 ----
  	cmdpush(CS_ELSE);
  	while (tok == SEPER)
  	    yylex();
! 	if (tok == INBRACE && usebrace) {
! 	    yylex();
! 	    l = par_list();
! 	    if (tok != OUTBRACE) {
! 		cmdpop();
! 		YYERRORV;
! 	    }
! 	} else {
! 	    l = par_list();
! 	    if (tok != FI) {
! 		cmdpop();
! 		YYERRORV;
! 	    }
  	}
  	addlinknode(thensl, l);
  	nt++;


  reply	other threads:[~1996-08-22 21:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-21 16:39 Matt Liggett
1996-08-21 19:14 ` Bart Schaefer
1996-08-22 21:10   ` Zoltan Hidvegi [this message]
1996-08-22 23:35     ` Semantics of compctl -X Greg J. Badros
1996-08-23 17:57       ` Zoltan Hidvegi

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=199608222110.XAA16315@bolyai.cs.elte.hu \
    --to=hzoli@cs.elte.hu \
    --cc=mliggett@pobox.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).