home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / src / cmd / lex / lib / reject.c < prev    next >
Encoding:
C/C++ Source or Header  |  1979-01-10  |  832 b   |  42 lines

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