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