Re-worked case statement parsing. With luck, this fixes bug #268.
This commit is contained in:
parent
6b3b8882fb
commit
d8e5937418
|
@ -401,7 +401,8 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
|
|||
if (lasttoken != TWORD || ! equal(wordtext, "in"))
|
||||
synerror("expecting \"in\"");
|
||||
cpp = &n1->ncase.cases;
|
||||
while (checkkwd = 2, readtoken() == TWORD) {
|
||||
checkkwd = 2, readtoken();
|
||||
do {
|
||||
*cpp = cp = (union node *)stalloc(sizeof (struct nclist));
|
||||
cp->type = NCLIST;
|
||||
app = &cp->nclist.pattern;
|
||||
|
@ -410,25 +411,25 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
|
|||
ap->type = NARG;
|
||||
ap->narg.text = wordtext;
|
||||
ap->narg.backquote = backquotelist;
|
||||
if (readtoken() != TPIPE)
|
||||
if (checkkwd = 2, readtoken() != TPIPE)
|
||||
break;
|
||||
app = &ap->narg.next;
|
||||
if (readtoken() != TWORD)
|
||||
synexpect(TWORD);
|
||||
}
|
||||
ap->narg.next = NULL;
|
||||
if (lasttoken != TRP)
|
||||
synexpect(TRP);
|
||||
cp->nclist.body = list(0);
|
||||
if ((t = readtoken()) == TESAC)
|
||||
tokpushback++;
|
||||
else if (t != TENDCASE)
|
||||
synexpect(TENDCASE);
|
||||
|
||||
checkkwd = 2;
|
||||
if ((t = readtoken()) != TESAC) {
|
||||
if (t != TENDCASE)
|
||||
synexpect(TENDCASE);
|
||||
else
|
||||
checkkwd = 2, readtoken();
|
||||
}
|
||||
cpp = &cp->nclist.next;
|
||||
}
|
||||
} while(lasttoken != TESAC);
|
||||
*cpp = NULL;
|
||||
if (lasttoken != TESAC)
|
||||
synexpect(TESAC);
|
||||
checkkwd = 1;
|
||||
break;
|
||||
case TLP:
|
||||
|
|
Loading…
Reference in New Issue