Fix: error recovery sometimes skipped tokens it needed later on

This commit is contained in:
ceriel 1994-04-19 09:38:00 +00:00
parent 958aced01b
commit 656fb00e9b
2 changed files with 30 additions and 1 deletions

View file

@ -10,7 +10,7 @@
extern int LLsymb;
#define LL_SAFE(x) /* Nothing */
#define LL_SSCANDONE(x) if (LLsymb != x) LLerror(x); else
#define LL_SSCANDONE(x) if (LLsymb != x) LLsafeerror(x); else
#define LL_SCANDONE(x) if (LLsymb != x) LLerror(x); else
#define LL_NOSCANDONE(x) LLscan(x)
#ifdef LL_FASTER
@ -32,6 +32,7 @@ extern void LLread(void);
extern int LLskip(void);
extern int LLnext(int);
extern void LLerror(int);
extern void LLsafeerror(int);
extern void LLnewlevel(unsigned int *);
extern void LLoldlevel(unsigned int *);
#ifndef LL_FASTER
@ -45,6 +46,7 @@ extern LLread();
extern int LLskip();
extern int LLnext();
extern LLerror();
extern LLsafeerror();
extern LLnewlevel();
extern LLoldlevel();
#ifndef LL_FASTER

View file

@ -97,6 +97,33 @@ LLerror(t)
if (LLsymb != t) LLmessage(t);
}
#if LL_ANSI_C
void LLsafeerror(int t)
#else
LLsafeerror(t)
int t;
#endif
{
register int i;
if (t == EOFILE && LLsymb <= 0) return;
#ifdef LL_NEWMESS
if (t == EOFILE) {
#ifdef LL_USERHOOK
static int lst[] = { EOFILE, 0 };
if (LLuserhook(EOFILE, lst)) /* nothing */;
#endif /* LL_USERHOOK */
if (LLsymb != EOFILE && LLsymb > 0) {
LLmessage(-1);
while ((LLsymb = LL_LEXI()) > 0 && LLsymb != EOFILE)
/* nothing */ ;
}
return;
}
#endif
LLmessage(t);
}
#ifndef LLNOFIRSTS
#if LL_ANSI_C
int LLfirst(int x, int d) {