Blob


1 #pragma lib "libl.a"
2 int yylineno =1;
3 # define YYU(x) x
4 char yytext[YYLMAX];
5 struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
6 Uchar yysbuf[YYLMAX];
7 Uchar *yysptr = yysbuf;
8 int *yyfnd;
9 extern struct yysvf *yyestate;
10 int yyprevious = YYNEWLINE;
11 # ifdef LEXDEBUG
12 extern void allprint(char);
13 # endif
14 yylook(void){
15 struct yysvf *yystate, **lsp;
16 struct yywork *yyt;
17 struct yysvf *yyz;
18 int yych;
19 struct yywork *yyr;
20 # ifdef LEXDEBUG
21 int debug;
22 # endif
23 Uchar *yylastch;
24 /* start off machines */
25 # ifdef LEXDEBUG
26 debug = 0;
27 # endif
28 if (!yymorfg)
29 yylastch = (Uchar*)yytext;
30 else {
31 yymorfg=0;
32 yylastch = (Uchar*)yytext+yyleng;
33 }
34 for(;;){
35 lsp = yylstate;
36 yyestate = yystate = yybgin;
37 if (yyprevious==YYNEWLINE) yystate++;
38 for (;;){
39 # ifdef LEXDEBUG
40 if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
41 # endif
42 yyt = yystate->yystoff;
43 if(yyt == yycrank){ /* may not be any transitions */
44 yyz = yystate->yyother;
45 if(yyz == 0)break;
46 if(yyz->yystoff == yycrank)break;
47 }
48 *yylastch++ = yych = input();
49 tryagain:
50 # ifdef LEXDEBUG
51 if(debug){
52 fprintf(yyout,"char ");
53 allprint(yych);
54 putchar('\n');
55 }
56 # endif
57 yyr = yyt;
58 if ( (int)yyt > (int)yycrank){
59 yyt = yyr + yych;
60 if (yyt <= yytop && yyt->verify+yysvec == yystate){
61 if(yyt->advance+yysvec == YYLERR) /* error transitions */
62 {unput(*--yylastch);break;}
63 *lsp++ = yystate = yyt->advance+yysvec;
64 goto contin;
65 }
66 }
67 # ifdef YYOPTIM
68 else if((int)yyt < (int)yycrank) { /* r < yycrank */
69 yyt = yyr = yycrank+(yycrank-yyt);
70 # ifdef LEXDEBUG
71 if(debug)fprintf(yyout,"compressed state\n");
72 # endif
73 yyt = yyt + yych;
74 if(yyt <= yytop && yyt->verify+yysvec == yystate){
75 if(yyt->advance+yysvec == YYLERR) /* error transitions */
76 {unput(*--yylastch);break;}
77 *lsp++ = yystate = yyt->advance+yysvec;
78 goto contin;
79 }
80 yyt = yyr + YYU(yymatch[yych]);
81 # ifdef LEXDEBUG
82 if(debug){
83 fprintf(yyout,"try fall back character ");
84 allprint(YYU(yymatch[yych]));
85 putchar('\n');
86 }
87 # endif
88 if(yyt <= yytop && yyt->verify+yysvec == yystate){
89 if(yyt->advance+yysvec == YYLERR) /* error transition */
90 {unput(*--yylastch);break;}
91 *lsp++ = yystate = yyt->advance+yysvec;
92 goto contin;
93 }
94 }
95 if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
96 # ifdef LEXDEBUG
97 if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
98 # endif
99 goto tryagain;
101 # endif
102 else
103 {unput(*--yylastch);break;}
104 contin:
105 # ifdef LEXDEBUG
106 if(debug){
107 fprintf(yyout,"state %d char ",yystate-yysvec-1);
108 allprint(yych);
109 putchar('\n');
111 # endif
114 # ifdef LEXDEBUG
115 if(debug){
116 fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
117 allprint(yych);
118 putchar('\n');
120 # endif
121 while (lsp-- > yylstate){
122 *yylastch-- = 0;
123 if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
124 yyolsp = lsp;
125 if(yyextra[*yyfnd]){ /* must backup */
126 while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
127 lsp--;
128 unput(*yylastch--);
131 yyprevious = YYU(*yylastch);
132 yylsp = lsp;
133 yyleng = yylastch-(Uchar*)yytext+1;
134 yytext[yyleng] = 0;
135 # ifdef LEXDEBUG
136 if(debug){
137 fprintf(yyout,"\nmatch '%s'", yytext);
138 fprintf(yyout," action %d\n",*yyfnd);
140 # endif
141 return(*yyfnd++);
143 unput(*yylastch);
145 if (yytext[0] == 0 /* && feof(yyin) */)
147 yysptr=yysbuf;
148 return(0);
150 yyprevious = input();
151 yytext[0] = yyprevious;
152 if (yyprevious>0)
153 output(yyprevious);
154 yylastch = (Uchar*)yytext;
155 # ifdef LEXDEBUG
156 if(debug)putchar('\n');
157 # endif
159 return(0); /* shut up the compiler; i have no idea what should be returned */
161 yyback(int *p, int m)
163 if (p==0) return(0);
164 while (*p)
166 if (*p++ == m)
167 return(1);
169 return(0);
171 /* the following are only used in the lex library */
172 yyinput(void){
173 return(input());
175 void
176 yyoutput(int c)
178 output(c);
180 void
181 yyunput(int c)
183 unput(c);