different "onerror" handling

This commit is contained in:
ceriel 1987-04-13 16:34:46 +00:00
parent 4805d67ca1
commit 7158b3a1f6

View file

@ -58,7 +58,8 @@ LLerror(t) {
#ifdef LL_NEWMESS #ifdef LL_NEWMESS
if (t == EOFILE) { if (t == EOFILE) {
#ifdef LL_USERHOOK #ifdef LL_USERHOOK
LLuserhook(EOFILE); static int lst[] = { EOFILE, 0 };
LLuserhook(EOFILE, lst);
#endif LL_USERHOOK #endif LL_USERHOOK
if (LLsymb != EOFILE) { if (LLsymb != EOFILE) {
LLmessage(-1); LLmessage(-1);
@ -119,16 +120,43 @@ LLskip() {
return LLdoskip(0); return LLdoskip(0);
} }
LLuserhook(exp) LLuserhook(exp, list)
int *list;
{ {
int old = LLsymb; int old = LLsymb;
LL_USERHOOK(exp); LL_USERHOOK(exp, list);
LLread(); LLread();
return LLsymb != old; return LLsymb != old;
} }
LLmklist(list)
register int *list;
{
char Xset[LL_SSIZE];
register char *p;
register int i;
for (p = &Xset[0]; p < &Xset[LL_SSIZE]; ) *p++ = 0;
for (i = 0; i < LL_NTERMINALS; i++) {
if (LLtcnt[i] != 0) Xset[i >> 3] |= (1 << (i & 07));
}
for (i = LL_NSETS - 1; i >= 0; i--) if (LLscnt[i] != 0) {
register char *q = &LLsets[LL_SSIZE * i];
p = &Xset[0];
while (p < &Xset[LL_SSIZE]) *p++ |= *q++;
}
for (i = 0; i < LL_NTERMINALS; i++) {
if (Xset[i >> 3] & (1 << (i & 07))) {
*list++ = LLtok[i];
}
}
*list = 0;
}
LLdoskip(exp) { LLdoskip(exp) {
int LLx; int LLx;
int list[LL_NTERMINALS+1];
#endif LL_USERHOOK #endif LL_USERHOOK
register int i; register int i;
int retval; int retval;
@ -136,23 +164,34 @@ LLdoskip(exp) {
retval = 0; retval = 0;
#ifdef LL_USERHOOK #ifdef LL_USERHOOK
LLx = LLuserhook(exp); LLmklist(list);
LLx = LLuserhook(exp, list);
if (LLx) retval = 1; if (LLx) retval = 1;
#endif LL_USERHOOK #endif LL_USERHOOK
for (;;) { for (;;) {
if (LLtcnt[LLcsymb] != 0) return retval; if (LLtcnt[LLcsymb] != 0) {
#ifdef LL_USERHOOK
if (!exp || !LLx || LLsymb == exp)
#endif
return retval;
}
LLi = LLcsymb >> 3; LLi = LLcsymb >> 3;
LLb = 1 << (LLcsymb & 07); LLb = 1 << (LLcsymb & 07);
for (i = LL_NSETS - 1; i >= 0; i--) { for (i = LL_NSETS - 1; i >= 0; i--) {
if (LLscnt[i] != 0) { if (LLscnt[i] != 0) {
if (LLsets[LL_SSIZE*i+LLi] & LLb) { if (LLsets[LL_SSIZE*i+LLi] & LLb) {
#ifdef LL_USERHOOK
if (!exp || !LLx || LLsymb == exp)
#endif
return retval; return retval;
} }
} }
} }
#ifdef LL_USERHOOK #ifdef LL_USERHOOK
if (LLx) LLx = LLuserhook(exp); if (LLx) {
if (LLx) continue; LLx = LLuserhook(exp, list);
continue;
}
#endif LL_USERHOOK #endif LL_USERHOOK
LLmessage(0); LLmessage(0);
retval = 1; retval = 1;