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]--;}
/*
* 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;
}
/*
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 */
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;
}
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;
}
for (;;) {
if (LLtcnt[LLcsymb] != 0) {
#ifdef LL_USERHOOK
- if (!exp || !LLx || LLsymb == exp)
+ if (!exp || !LLx || LLcsymb == LLindex[exp])
#endif
return retval;
}
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;
}
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);