xref: /original-bsd/old/lex/libln/reject.c (revision 92c664ec)
1 /*	@(#)reject.c	4.2	12/21/87	*/
2 
3 # include <stdio.h>
4 extern FILE *yyout, *yyin;
5 extern int yyprevious , *yyfnd;
6 extern char yyextra[];
7 extern char yytext[];
8 extern int yyleng;
9 extern struct {int *yyaa, *yybb; int *yystops;} *yylstate [], **yylsp, **yyolsp;
10 
11 yyreject ()
12 {
13 for( ; yylsp < yyolsp; yylsp++)
14 	yytext[yyleng++] = yyinput();
15 if (*yyfnd > 0)
16 	return(yyracc(*yyfnd++));
17 while (yylsp-- > yylstate)
18 	{
19 	yyunput(yytext[yyleng-1]);
20 	yytext[--yyleng] = 0;
21 	if (*yylsp != 0 && (yyfnd= (*yylsp)->yystops) && *yyfnd > 0)
22 		return(yyracc(*yyfnd++));
23 	}
24 if (yytext[0] == 0)
25 	return(0);
26 yyoutput(yyprevious = yyinput());
27 yyleng=0;
28 return(-1);
29 }
30 yyracc(m)
31 {
32 yyolsp = yylsp;
33 if (yyextra[m])
34 	{
35 	while (yyback((*yylsp)->yystops, -m) != 1 && yylsp>yylstate)
36 		{
37 		yylsp--;
38 		yyunput(yytext[--yyleng]);
39 		}
40 	}
41 yyprevious = yytext[yyleng-1];
42 yytext[yyleng] = 0;
43 return(m);
44 }
45