Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug in case stmt with '('
- X-seq: zsh-workers 1734
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx, Zoltan Hidvegi <hzoli@xxxxxxxxxx>
- Subject: Re: Bug in case stmt with '('
- Date: Sun, 21 Jul 1996 23:53:22 -0700
- In-reply-to: "Bart Schaefer" <schaefer>        "Re: Bug in case stmt with '('" (Jul 21, 11:31pm)
- References: <199607191600.SAA08613@xxxxxxxxxxxxxxxxx> 	<9607211853.ZM979@xxxxxxxxxx> 	<960721233102.ZM22696@xxxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: schaefer@xxxxxxx
On Jul 21, 11:31pm, Bart Schaefer wrote:
} Subject: Re: Bug in case stmt with '('
}
} I think we should leave it POSIX-style.
} 
} However, there is a remaining bug in Zoltan's patch.
} 
} zagzig<8> case foo in
} > (foo) echo yes;;
} zsh: parse error near `echo'
} 
} Apparently there still needs to be at least one token between the close
} paren and the first word of the actual command.
I thought Zoltan's "if" cascade looked a little too easy.  Here's the fix.
*** Src/parse.c.0	Fri Jul 19 11:17:12 1996
--- Src/parse.c	Sun Jul 21 23:45:10 1996
***************
*** 522,544 ****
  		str2[sl] = Bar;
  		str2[sl+1] = '\0';
  		str = str2;
! 	    } else if (tok == STRING) {
! 		char *str2;
  		int sl = strlen(str);
  
! 		if (str[sl - 1] != Bar)
! 		    YYERRORV;
! 		str2 = ncalloc(sl + strlen(tokstr) + 1);
! 		strcpy(str2, str);
! 		strcpy(str2 + sl, tokstr);
! 		str = str2;
! 	    } else {
! 		/* POSIX allows (foo*) patterns */
! 		char *s = str;
  
! 		if (skipparens(Inpar, Outpar, &s) || *s)
! 		    YYERRORV;
! 		break;
  	    }
  	}
  	addlinknode(pats, str);
--- 522,547 ----
  		str2[sl] = Bar;
  		str2[sl+1] = '\0';
  		str = str2;
! 	    } else {
  		int sl = strlen(str);
  
! 		if (str[sl - 1] != Bar) {
! 		    /* POSIX allows (foo*) patterns */
! 		    char *s = str;
  
! 		    if (skipparens(Inpar, Outpar, &s) || *s)
! 			YYERRORV;
! 		    break;
! 		} else {
! 		    char *str2;
! 
! 		    if (tok != STRING)
! 			YYERRORV;
! 		    str2 = ncalloc(sl + strlen(tokstr) + 1);
! 		    strcpy(str2, str);
! 		    strcpy(str2 + sl, tokstr);
! 		    str = str2;
! 		}
  	    }
  	}
  	addlinknode(pats, str);
***************
-- 
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"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author