Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh-3.1.4 bug, parsing case ... esac
- X-seq: zsh-workers 4376
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxx>
- To: schaefer@xxxxxxxxxxxxxxxx (Bart Schaefer)
- Subject: Re: zsh-3.1.4 bug, parsing case ... esac
- Date: Thu, 3 Sep 1998 00:43:31 -0500 (CDT)
- Cc: steve@xxxxxxxxxx, zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: <980902205229.ZM1419@xxxxxxxxxxxxxxxxxxxxxxx> from Bart Schaefer at "Sep 2, 98 08:52:29 pm"
> On Sep 2, 5:53pm, SL Baur wrote:
> } Subject: zsh-3.1.4 bug, parsing case ... esac
> }
> } zsh: parse error near `echo'
> } zsh: parse error in command substitution
> }
> } esac else echo bison ;
> }
> } adding a semicolon after the esac makes the messages go away, but I
> } think this should work as is.
>
> Blech. That sure doesn't parse according to the bash manual. The
> stuff between "then" and "else" has to be a properly-terminated list,
> which means it has to end with ; & or newline.
Actually, the shell grammar allows this, this is really a zsh bug.
For example,
if true; then if true; then echo foo; fi else echo bar; fi
is accepted by zsh although there is no semicolon between fi and else.
Similarily
if ((some math)) then ((some other math)) fi
works. Same for [[ ... ]].
Zoli
*** Src/parse.c~ Sat May 2 03:45:37 1998
--- Src/parse.c Thu Sep 3 00:36:33 1998
***************
*** 542,557 ****
while (tok == SEPER)
yylex();
! if (tok == OUTBRACE) {
! yylex();
break;
- }
if (tok != STRING)
YYERRORV;
! if (!strcmp(tokstr, "esac")) {
! yylex();
break;
- }
str = ncalloc(strlen(tokstr) + 2);
*str = ';';
strcpy(str + 1, tokstr);
--- 542,553 ----
while (tok == SEPER)
yylex();
! if (tok == OUTBRACE)
break;
if (tok != STRING)
YYERRORV;
! if (!strcmp(tokstr, "esac"))
break;
str = ncalloc(strlen(tokstr) + 2);
*str = ';';
strcpy(str + 1, tokstr);
***************
*** 618,627 ****
addlinknode(pats, str);
addlinknode(lists, par_list());
n++;
! if ((tok == ESAC && !brflag) || (tok == OUTBRACE && brflag)) {
! yylex();
break;
- }
if(tok == SEMIAMP)
*str = '&';
else if (tok != DSEMI)
--- 614,621 ----
addlinknode(pats, str);
addlinknode(lists, par_list());
n++;
! if ((tok == ESAC && !brflag) || (tok == OUTBRACE && brflag))
break;
if(tok == SEMIAMP)
*str = '&';
else if (tok != DSEMI)
***************
*** 630,635 ****
--- 624,632 ----
incmdpos = 0;
yylex();
}
+
+ incmdpos = 1;
+ yylex();
cc->pats = (char **)alloc((n + 1) * sizeof(char *));
Messages sorted by:
Reverse Date,
Date,
Thread,
Author