From: ceriel Date: Fri, 24 Jun 1988 11:48:10 +0000 (+0000) Subject: modified generation of token mapping somewhat X-Git-Tag: release-5-5~3158 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=e1f7d20251a36b8921af1eb11f7ace872ec78120;p=ack.git modified generation of token mapping somewhat --- diff --git a/util/LLgen/lib/incl b/util/LLgen/lib/incl index 49ca95326..f32a982e9 100644 --- a/util/LLgen/lib/incl +++ b/util/LLgen/lib/incl @@ -17,7 +17,6 @@ extern int LLsymb; extern unsigned int LLscnt[]; extern unsigned int LLtcnt[]; extern int LLcsymb; -extern int LL_symb; #define LLsdecr(d) {LL_assert(LLscnt[d] > 0); LLscnt[d]--;} #define LLtdecr(d) {LL_assert(LLtcnt[d] > 0); LLtcnt[d]--;} diff --git a/util/LLgen/lib/rec b/util/LLgen/lib/rec index 071a23ce7..91bdd1973 100644 --- a/util/LLgen/lib/rec +++ b/util/LLgen/lib/rec @@ -32,8 +32,7 @@ LLscan(t) { /* * Check if the next symbol is equal to the parameter */ - if ((LLsymb = LL_LEXI()) <= 0) LLsymb = EOFILE; - if (LLsymb == t) { + if ((LLsymb = LL_LEXI()) == t) { return; } /* @@ -44,8 +43,7 @@ LLscan(t) { LLread() { for (;;) { - if ((LLsymb = LL_LEXI()) <= 0) LLsymb = EOFILE; - if ((LLcsymb = LLindex[LLsymb]) >= 0) return; + if ((LLcsymb = LLindex[(LLsymb = LL_LEXI())]) >= 0) return; LLmessage(0); } /* NOTREACHED */ @@ -54,15 +52,17 @@ LLread() { LLerror(t) { register int i; + if (t == EOFILE && LLsymb <= 0) return; #ifdef LL_NEWMESS if (t == EOFILE) { #ifdef LL_USERHOOK static int lst[] = { EOFILE, 0 }; LLuserhook(EOFILE, lst); #endif LL_USERHOOK - if (LLsymb != EOFILE) { + if (LLsymb != EOFILE && LLsymb > 0) { LLmessage(-1); - while ((LLsymb = LL_LEXI()) > 0) /* nothing */ ; + while ((LLsymb = LL_LEXI()) > 0 && LLsymb != EOFILE) + /* nothing */ ; } return; } @@ -107,7 +107,7 @@ LLnext(n) { if (n <= 0 && LLsets[(LLcsymb >> 3) - n] & (1 << (LLcsymb & 07))) { retval |= 2; } - else if (LLsymb == n) retval |= 2; + else if (n > 0 && LLcsymb == LLindex[n]) retval |= 2; return retval; } @@ -170,7 +170,7 @@ LLdoskip(exp) { for (;;) { if (LLtcnt[LLcsymb] != 0) { #ifdef LL_USERHOOK - if (!exp || !LLx || LLsymb == exp) + if (!exp || !LLx || LLcsymb == LLindex[exp]) #endif return retval; } @@ -180,7 +180,7 @@ LLdoskip(exp) { if (LLscnt[i] != 0) { if (LLsets[LL_SSIZE*i+LLi] & LLb) { #ifdef LL_USERHOOK - if (!exp || !LLx || LLsymb == exp) + if (!exp || !LLx || LLcsymb == LLindex[exp]) #endif return retval; } diff --git a/util/LLgen/src/gencode.c b/util/LLgen/src/gencode.c index 8b6704bd4..05cff5733 100644 --- a/util/LLgen/src/gencode.c +++ b/util/LLgen/src/gencode.c @@ -208,8 +208,8 @@ genrecovery() { for (t = tokens; t < maxt; t++) { index[t->t_tokno] = t - tokens; } - fputs("static short LLindex[] = {\n",f); - for (q = index; q < &index[assval]; q++) { + fputs("#define LLindex (LL_index+1)\nstatic short LL_index[] = {0,0,\n",f); + for (q = index+1; q < &index[assval]; q++) { fprintf(f, "%d,\n", *q); } fputs(c_arrend, f);