Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: 3.0.5 - Re: zsh-3.1.4 bug, parsing case ... esac



On Sep 3, 12:43am, Zoltan Hidvegi wrote:
} Subject: Re: zsh-3.1.4 bug, parsing case ... esac
} > }
} > } zsh: parse error near `echo'
} > } zsh: parse error in command substitution
} > } 
} > } 		esac else echo bison ;
} 
} Actually, the shell grammar allows this, this is really a zsh bug.

Here's Zoltan's patch tweaked for 3.0.5.

Index: Src/parse.c
===================================================================
--- parse.c	1998/07/02 15:56:02	1.6
+++ parse.c	1998/09/03 14:55:26
@@ -482,16 +482,12 @@
 
 	while (tok == SEPER)
 	    yylex();
-	if (tok == OUTBRACE) {
-	    yylex();
+	if (tok == OUTBRACE)
 	    break;
-	}
 	if (tok != STRING)
 	    YYERRORV;
-	if (!strcmp(tokstr, "esac")) {
-	    yylex();
+	if (!strcmp(tokstr, "esac"))
 	    break;
-	}
 	str = tokstr;
 	incasepat = 0;
 	incmdpos = 1;
@@ -556,16 +552,17 @@
 	addlinknode(pats, str);
 	addlinknode(lists, par_list());
 	n++;
-	if ((tok == ESAC && !brflag) || (tok == OUTBRACE && brflag)) {
-	    yylex();
+	if ((tok == ESAC && !brflag) || (tok == OUTBRACE && brflag))
 	    break;
-	}
 	if (tok != DSEMI)
 	    YYERRORV;
 	incasepat = 1;
 	incmdpos = 0;
 	yylex();
     }
+
+    incmdpos = 1;
+    yylex();
 
     cc->pats = (char **)alloc((n + 1) * sizeof(char *));
 


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author