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