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