reject.c 985 B

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