From 910dc80a58cf3bcf91c51a72f117a46a7c9f77cf Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Mon, 18 Oct 1999 09:57:00 +0000 Subject: zsh-workers/8319 --- Src/parse.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'Src/parse.c') diff --git a/Src/parse.c b/Src/parse.c index d0a9bc45f..e5d067f8d 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -539,6 +539,7 @@ par_case(Cmd c) LinkList pats, lists; int n = 1; char **pp; + Patprog *ppp; List *ll; LinkNode no; struct casecmd *cc; @@ -659,11 +660,17 @@ par_case(Cmd c) incmdpos = 1; yylex(); - cc->pats = (char **)alloc((n + 1) * sizeof(char *)); + cc->pats = (char **) alloc((n + 1) * sizeof(char *)); + cc->progs = (Patprog *) alloc((n + 1) * sizeof(Patprog)); - for (pp = cc->pats, no = firstnode(pats); no; incnode(no)) + for (pp = cc->pats, ppp = cc->progs, no = firstnode(pats); + no; incnode(no)) { *pp++ = (char *)getdata(no); + *ppp++ = dummy_patprog1; + } *pp = NULL; + *ppp = NULL; + cc->lists = (List *) alloc((n + 1) * sizeof(List)); for (ll = cc->lists, no = firstnode(lists); no; incnode(no), ll++) if (!(*ll = (List) getdata(no))) @@ -1438,18 +1445,21 @@ par_cond_triple(char *a, char *b, char *c) Cond n = (Cond) make_cond(); int t0; - n->ntype = NT_SET(N_COND, NT_STR, NT_STR, 0, 0); n->left = (void *) a; n->right = (void *) c; + n->prog = dummy_patprog1; if ((b[0] == Equals || b[0] == '=') && - (!b[1] || ((b[1] == Equals || b[1] == '=') && !b[2]))) + (!b[1] || ((b[1] == Equals || b[1] == '=') && !b[2]))) { + n->ntype = NT_SET(N_COND, NT_STR, NT_STR, NT_PAT, 0); n->type = COND_STREQ; - else if (b[0] == '!' && (b[1] == Equals || b[1] == '=') && !b[2]) + } else if (b[0] == '!' && (b[1] == Equals || b[1] == '=') && !b[2]) { + n->ntype = NT_SET(N_COND, NT_STR, NT_STR, NT_PAT, 0); n->type = COND_STRNEQ; - else if (b[0] == '-') { - if ((t0 = get_cond_num(b + 1)) > -1) + } else if (b[0] == '-') { + if ((t0 = get_cond_num(b + 1)) > -1) { + n->ntype = NT_SET(N_COND, NT_STR, NT_STR, 0, 0); n->type = t0 + COND_NT; - else { + } else { char *d[3]; n->ntype = NT_SET(N_COND, NT_STR, NT_STR | NT_ARR, 0, 0); -- cgit 1.4.1