xref: /csrg-svn/old/lex/libln/reject.c (revision 33068)
1*33068Sbostic /*	@(#)reject.c	4.2	12/21/87	*/
29919Ssam 
39919Ssam # include <stdio.h>
49919Ssam extern FILE *yyout, *yyin;
59919Ssam extern int yyprevious , *yyfnd;
69919Ssam extern char yyextra[];
79919Ssam extern char yytext[];
89919Ssam extern int yyleng;
9*33068Sbostic extern struct {int *yyaa, *yybb; int *yystops;} *yylstate [], **yylsp, **yyolsp;
10*33068Sbostic 
yyreject()11*33068Sbostic yyreject ()
12*33068Sbostic {
139919Ssam for( ; yylsp < yyolsp; yylsp++)
149919Ssam 	yytext[yyleng++] = yyinput();
159919Ssam if (*yyfnd > 0)
169919Ssam 	return(yyracc(*yyfnd++));
179919Ssam while (yylsp-- > yylstate)
189919Ssam 	{
199919Ssam 	yyunput(yytext[yyleng-1]);
209919Ssam 	yytext[--yyleng] = 0;
219919Ssam 	if (*yylsp != 0 && (yyfnd= (*yylsp)->yystops) && *yyfnd > 0)
229919Ssam 		return(yyracc(*yyfnd++));
239919Ssam 	}
249919Ssam if (yytext[0] == 0)
259919Ssam 	return(0);
269919Ssam yyoutput(yyprevious = yyinput());
279919Ssam yyleng=0;
289919Ssam return(-1);
299919Ssam }
yyracc(m)309919Ssam yyracc(m)
319919Ssam {
329919Ssam yyolsp = yylsp;
339919Ssam if (yyextra[m])
349919Ssam 	{
359919Ssam 	while (yyback((*yylsp)->yystops, -m) != 1 && yylsp>yylstate)
369919Ssam 		{
379919Ssam 		yylsp--;
389919Ssam 		yyunput(yytext[--yyleng]);
399919Ssam 		}
409919Ssam 	}
419919Ssam yyprevious = yytext[yyleng-1];
429919Ssam yytext[yyleng] = 0;
439919Ssam return(m);
449919Ssam }
45