1 #include <stdio.h>
2 # define U(x) ((x)&0377)
3 # define NLSTATE yyprevious=YYNEWLINE
4 # define BEGIN yybgin = yysvec + 1 +
5 # define INITIAL 0
6 # define YYLERR yysvec
7 # define YYSTATE (yyestate-yysvec-1)
8 # define YYOPTIM 1
9 # define YYLMAX 200
10 # define output(c) putc(c,yyout)
11 # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
12 # define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
13 # define yymore() (yymorfg=1)
14 # define ECHO fprintf(yyout, "%s",yytext)
15 # define REJECT { nstr = yyreject(); goto yyfussy;}
16 int yyleng; extern char yytext[];
17 int yymorfg;
18 extern char *yysptr, yysbuf[];
19 int yytchar;
20 FILE *yyin = NULL, *yyout = NULL;
21 extern int yylineno;
22 struct yysvf {
23 	struct yywork *yystoff;
24 	struct yysvf *yyother;
25 	int *yystops;};
26 struct yysvf *yyestate;
27 extern struct yysvf yysvec[], *yybgin;
28 /* -----------------------------------------------------------------
29 FILE:	    readnets_lex
30 DESCRIPTION:rules for lexical analyzer in readnets.  This lexical
31 	    analyzer uses a binary search to reduce the size of
32 	    the f.a.  generated by lex.  Thanks to Gary Richey who
33 	    showed me the trick.  See chapter 3 of "Introduction
34 	    to Compiler Construction with UNIX" by Schreiner &
35 	    Friedman for more details.
36 CONTENTS:   lex rules -
37 	    screen()
38 DATE:	    Oct 19, 1988 - original coding
39 	    static char SccsId[] = "@(#) readnets.l version 3.9 4/18/91" ;
40 REVISIONS:  Feb  9, 1990 - expanded ASCII character set.
41 	    Apr 23, 1990 - added Cstyle comments.
42 	    Sun Dec 16 00:41:42 EST 1990 - added max_voltage_drop
43 		and added comma to input format.
44 	    Thu Dec 20 00:01:20 EST 1990 - updated FLOAT def.
45 	    Mon Jan 21 22:31:24 PST 1991 - added ASCII charset for
46 		alphanum.
47 	    Thu Mar 14 16:13:06 CST 1991 - added missing characters.
48 	    Fri Mar 22 20:03:52 CST 1991 - made letter more general.
49 	    Thu Apr 18 01:43:35 EDT 1991 - moved placement of COLON
50 ----------------------------------------------------------------- */
51 #undef   YYLMAX
52 #define  YYLMAX 2000       /* comments may be at most 2000 characters */
53 
54 #define token(x)      x    /* makes it look like regular lex */
55 #define END(v) (v-1 + sizeof(v) / sizeof( v[0] ) ) /* for table lookup */
56 
57 static INT screen() ;
58 static void check_line_count() ;
59 
60 static int yylook(void);
61 static int yyback(int *p, int m);
62 
63 # define YYNEWLINE 10
yylex()64 INT yylex(){
65 int nstr; extern int yyprevious;
66 while((nstr = yylook()) >= 0)
67 yyfussy: switch(nstr){
68 case 0:
69 if(yywrap()) return(0); break;
70 case 1:
71 
72 		      {
73 			/* C-style comments over multiple lines */
74           		check_line_count(yytext) ;
75 	              }
76 break;
77 case 2:
78       {
79 		         /* convert to an integer */
80 		         yylval.ival = atoi( yytext ) ;
81 	  	         return (INTEGER);
82 	              }
83 break;
84 case 3:
85  {
86 		         /* convert to an integer */
87 		         yylval.fval = atof( yytext ) ;
88 	  	         return (FLOAT);
89 		      }
90 break;
91 case 4:
92  {
93 		         /* convert to an integer */
94 		         yylval.fval = atof( yytext ) ;
95 	  	         return (FLOAT);
96 		      }
97 break;
98 case 5:
99               {  return(COLON); }
100 break;
101 case 6:
102   {  return( screen() ) ; }
103 break;
104 case 7:
105               {  return(COMMA); }
106 break;
107 case 8:
108            {  line_countS++;}
109 break;
110 case 9:
111              ;
112 break;
113 case 10:
114               {  return( token(yytext[0]) ) ;}
115 break;
116 case -1:
117 break;
118 default:
119 fprintf(yyout,"bad switch yylook %d",nstr);
120 } return(0); }
121 /* end of yylex */
122 
123 /* reserved word screener */
124 /* -----------------------------------------------------------------
125     The following is table of the reserved words - Table must be in
126     alphabetical order for binary search to work properly.
127 ----------------------------------------------------------------- */
128 static struct rw_table {  /* reserved word table */
129     char *rw_name ;      /* pattern */
130     INT rw_yylex  ;      /* lex token number */
131 } rwtable[] = {
132     "cap_match",         token(CAP_MATCH),
133     "cap_upper_bound",   token(CAP_UPPER_BOUND),
134     "common_point",      token(COMMON_POINT),
135     "max_voltage_drop",  token(MAX_VOLTAGE_DROP),
136     "net",               token(NET),
137     "net_cap_match",     token(NET_CAP_MATCH),
138     "net_res_match",     token(NET_RES_MATCH),
139     "noisy",             token(NOISY),
140     "path",              token(PATH),
141     "res_match",         token(RES_MATCH),
142     "res_upper_bound",   token(RES_UPPER_BOUND),
143     "sensitive",         token(SENSITIVE),
144     "shielding",         token(SHIELDING),
145     "timing",            token(TIMING)
146 } ;
147 
screen()148 static INT screen()
149 {
150     INT c ;
151     struct rw_table  *low = rwtable,        /* ptr to beginning */
152 		     *mid ,
153 		     *high = END(rwtable) ;   /* ptr to end */
154 
155     /* binary search to look thru table to find pattern match */
156     while( low <= high){
157 	mid = low + (high-low) / 2 ;
158 	if( (c = strcmp(mid->rw_name, yytext) ) == STRINGEQ){
159 	    return( mid->rw_yylex ) ; /* return token number */
160 	} else if( c < 0 ){
161 	    low = mid + 1 ;
162 	} else {
163 	    high = mid - 1 ;
164 	}
165     }
166     /* at this point we haven't found a match so we have a string */
167     /* save the string by making copy */
168     yylval.string = (char *) Ystrclone( yytext ) ;
169     return (STRING);
170 
171 } /* end screen function */
172 
check_line_count(s)173 static void check_line_count( s )
174 char *s ;
175 {
176     if( s ){
177 	if( strlen(s) >= YYLMAX ){
178 	    sprintf(YmsgG, "comment beginning at line %d ",line_countS+1 );
179 	    M( ERRMSG, "lex", YmsgG ) ;
180 	    sprintf(YmsgG,"exceeds maximum allowed length:%d chars.\n",
181 		YYLMAX );
182 	    M( MSG, NULL, YmsgG ) ;
183 	    setErrorFlag() ;
184 	}
185 	for( ;*s;s++ ){
186 	    if( *s == '\n'){
187 		line_countS++;
188 	    }
189 	}
190     }
191 } /* end check_line_count */
192 int yyvstop[] ={
193 0,
194 
195 9,
196 0,
197 
198 9,
199 0,
200 
201 10,
202 0,
203 
204 9,
205 10,
206 0,
207 
208 8,
209 0,
210 
211 6,
212 10,
213 0,
214 
215 6,
216 10,
217 0,
218 
219 6,
220 7,
221 10,
222 0,
223 
224 3,
225 6,
226 10,
227 0,
228 
229 6,
230 10,
231 0,
232 
233 2,
234 10,
235 0,
236 
237 5,
238 6,
239 10,
240 0,
241 
242 9,
243 0,
244 
245 6,
246 0,
247 
248 3,
249 6,
250 0,
251 
252 2,
253 6,
254 0,
255 
256 6,
257 0,
258 
259 3,
260 6,
261 0,
262 
263 2,
264 0,
265 
266 6,
267 0,
268 
269 6,
270 0,
271 
272 6,
273 0,
274 
275 6,
276 0,
277 
278 6,
279 0,
280 
281 4,
282 6,
283 0,
284 
285 6,
286 0,
287 
288 6,
289 0,
290 
291 1,
292 6,
293 0,
294 
295 1,
296 0,
297 
298 6,
299 0,
300 
301 1,
302 6,
303 0,
304 
305 1,
306 0,
307 0};
308 # define YYTYPE unsigned char
309 struct yywork { YYTYPE verify, advance; } yycrank[] ={
310 0,0,	0,0,	1,3,	0,0,
311 0,0,	0,0,	0,0,	0,0,
312 0,0,	0,0,	1,4,	1,5,
313 4,13,	0,0,	0,0,	0,0,
314 0,0,	0,0,	0,0,	0,0,
315 0,0,	0,0,	0,0,	0,0,
316 0,0,	0,0,	0,0,	0,0,
317 0,0,	0,0,	0,0,	0,0,
318 0,0,	0,0,	1,6,	4,13,
319 0,0,	0,0,	0,0,	0,0,
320 0,0,	0,0,	0,0,	1,6,
321 1,7,	1,8,	10,17,	1,9,
322 1,10,	1,11,	22,22,	29,35,
323 30,36,	34,28,	35,29,	36,29,
324 0,0,	0,0,	7,15,	1,12,
325 7,16,	7,16,	7,16,	7,16,
326 7,16,	7,16,	7,16,	7,16,
327 7,16,	7,16,	1,6,	6,14,
328 6,14,	6,14,	6,14,	6,14,
329 6,14,	6,14,	6,14,	6,14,
330 6,14,	6,14,	6,14,	6,14,
331 6,14,	6,14,	6,14,	6,14,
332 6,14,	6,14,	6,14,	6,14,
333 6,14,	6,14,	6,14,	6,14,
334 6,14,	6,14,	6,14,	6,14,
335 6,14,	6,14,	6,14,	6,14,
336 6,14,	6,14,	6,14,	6,14,
337 6,14,	6,14,	6,14,	6,14,
338 6,14,	6,14,	6,14,	6,14,
339 6,14,	6,14,	6,14,	6,14,
340 6,14,	6,14,	6,14,	6,14,
341 6,14,	6,14,	6,14,	6,14,
342 6,14,	6,14,	6,14,	6,14,
343 6,14,	6,14,	6,14,	6,14,
344 6,14,	6,14,	6,14,	6,14,
345 6,14,	6,14,	6,14,	6,14,
346 6,14,	6,14,	6,14,	6,14,
347 6,14,	6,14,	6,14,	6,14,
348 6,14,	6,14,	6,14,	6,14,
349 6,14,	6,14,	6,14,	6,14,
350 6,14,	6,14,	6,14,	6,14,
351 6,14,	9,15,	9,15,	9,15,
352 9,15,	9,15,	9,15,	9,15,
353 9,15,	9,15,	9,15,	11,18,
354 0,0,	11,19,	11,19,	11,19,
355 11,19,	11,19,	11,19,	11,19,
356 11,19,	11,19,	11,19,	15,15,
357 15,15,	15,15,	15,15,	15,15,
358 15,15,	15,15,	15,15,	15,15,
359 15,15,	16,18,	11,20,	16,16,
360 16,16,	16,16,	16,16,	16,16,
361 16,16,	16,16,	16,16,	16,16,
362 16,16,	0,0,	0,0,	0,0,
363 0,0,	17,21,	0,0,	0,0,
364 0,0,	0,0,	0,0,	0,0,
365 16,20,	17,21,	17,21,	0,0,
366 0,0,	0,0,	0,0,	0,0,
367 0,0,	0,0,	11,20,	0,0,
368 18,18,	18,18,	18,18,	18,18,
369 18,18,	18,18,	18,18,	18,18,
370 18,18,	18,18,	0,0,	0,0,
371 0,0,	17,22,	0,0,	0,0,
372 0,0,	0,0,	0,0,	0,0,
373 16,20,	18,20,	17,23,	17,22,
374 17,22,	0,0,	17,22,	17,24,
375 17,22,	0,0,	0,0,	0,0,
376 0,0,	0,0,	0,0,	0,0,
377 0,0,	19,18,	17,22,	19,19,
378 19,19,	19,19,	19,19,	19,19,
379 19,19,	19,19,	19,19,	19,19,
380 19,19,	17,22,	0,0,	0,0,
381 0,0,	18,20,	0,0,	0,0,
382 20,25,	0,0,	20,25,	0,0,
383 19,20,	20,26,	20,26,	20,26,
384 20,26,	20,26,	20,26,	20,26,
385 20,26,	20,26,	20,26,	21,21,
386 0,0,	0,0,	0,0,	0,0,
387 0,0,	0,0,	0,0,	23,28,
388 21,27,	21,21,	21,21,	0,0,
389 21,21,	21,21,	21,21,	23,28,
390 23,28,	0,0,	0,0,	0,0,
391 19,20,	0,0,	0,0,	0,0,
392 21,21,	25,26,	25,26,	25,26,
393 25,26,	25,26,	25,26,	25,26,
394 25,26,	25,26,	25,26,	21,21,
395 0,0,	0,0,	0,0,	23,29,
396 0,0,	0,0,	0,0,	0,0,
397 0,0,	0,0,	0,0,	0,0,
398 23,30,	23,29,	23,29,	0,0,
399 23,29,	23,31,	23,29,	0,0,
400 0,0,	0,0,	0,0,	0,0,
401 0,0,	0,0,	0,0,	0,0,
402 23,29,	26,26,	26,26,	26,26,
403 26,26,	26,26,	26,26,	26,26,
404 26,26,	26,26,	26,26,	23,29,
405 27,28,	0,0,	0,0,	0,0,
406 0,0,	0,0,	0,0,	28,21,
407 0,0,	27,32,	27,28,	27,28,
408 0,0,	27,28,	27,33,	27,28,
409 28,27,	28,21,	28,21,	0,0,
410 28,21,	28,34,	28,21,	0,0,
411 32,21,	27,28,	0,0,	0,0,
412 0,0,	0,0,	0,0,	0,0,
413 28,21,	32,27,	32,21,	32,21,
414 27,28,	32,21,	32,37,	32,21,
415 0,0,	0,0,	0,0,	28,21,
416 0,0,	0,0,	0,0,	0,0,
417 0,0,	32,21,	0,0,	0,0,
418 0,0,	0,0,	0,0,	0,0,
419 0,0,	0,0,	0,0,	0,0,
420 32,21,	0,0,	0,0,	0,0,
421 0,0};
422 struct yysvf yysvec[] ={
423 0,	0,	0,
424 yycrank+-1,	0,		yyvstop+1,
425 yycrank+0,	yysvec+1,	yyvstop+3,
426 yycrank+0,	0,		yyvstop+5,
427 yycrank+3,	0,		yyvstop+7,
428 yycrank+0,	0,		yyvstop+10,
429 yycrank+38,	0,		yyvstop+12,
430 yycrank+12,	yysvec+6,	yyvstop+15,
431 yycrank+0,	yysvec+6,	yyvstop+18,
432 yycrank+117,	yysvec+6,	yyvstop+22,
433 yycrank+4,	yysvec+6,	yyvstop+26,
434 yycrank+129,	yysvec+6,	yyvstop+29,
435 yycrank+0,	yysvec+6,	yyvstop+32,
436 yycrank+0,	yysvec+4,	yyvstop+36,
437 yycrank+0,	yysvec+6,	yyvstop+38,
438 yycrank+139,	yysvec+6,	yyvstop+40,
439 yycrank+151,	yysvec+6,	yyvstop+43,
440 yycrank+-212,	0,		yyvstop+46,
441 yycrank+184,	yysvec+6,	yyvstop+48,
442 yycrank+223,	yysvec+6,	yyvstop+51,
443 yycrank+245,	yysvec+6,	yyvstop+53,
444 yycrank+-270,	yysvec+17,	0,
445 yycrank+-3,	yysvec+17,	yyvstop+55,
446 yycrank+-310,	0,		yyvstop+57,
447 yycrank+0,	yysvec+17,	yyvstop+59,
448 yycrank+281,	yysvec+6,	yyvstop+61,
449 yycrank+321,	yysvec+6,	yyvstop+63,
450 yycrank+-347,	yysvec+23,	0,
451 yycrank+-354,	yysvec+17,	0,
452 yycrank+-4,	yysvec+17,	yyvstop+66,
453 yycrank+-5,	yysvec+17,	yyvstop+68,
454 yycrank+0,	yysvec+6,	yyvstop+70,
455 yycrank+-371,	yysvec+17,	0,
456 yycrank+0,	0,		yyvstop+73,
457 yycrank+6,	0,		0,
458 yycrank+7,	yysvec+6,	yyvstop+75,
459 yycrank+8,	yysvec+6,	yyvstop+77,
460 yycrank+0,	yysvec+34,	yyvstop+80,
461 0,	0,	0};
462 struct yywork *yytop = yycrank+440;
463 struct yysvf *yybgin = yysvec+1;
464 char yymatch[] ={
465 00  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
466 01  ,011 ,012 ,01  ,01  ,01  ,01  ,01  ,
467 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
468 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
469 011 ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,
470 '!' ,'!' ,'*' ,'+' ,',' ,'+' ,'.' ,'/' ,
471 '0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,
472 '0' ,'0' ,':' ,'!' ,'!' ,'!' ,'!' ,'!' ,
473 '!' ,'!' ,'!' ,'!' ,'!' ,'E' ,'!' ,'!' ,
474 '!' ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,
475 '!' ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,
476 '!' ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,
477 '!' ,'!' ,'!' ,'!' ,'!' ,'E' ,'!' ,'!' ,
478 '!' ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,
479 '!' ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,
480 '!' ,'!' ,'!' ,'!' ,'!' ,'!' ,'!' ,01  ,
481 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
482 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
483 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
484 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
485 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
486 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
487 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
488 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
489 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
490 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
491 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
492 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
493 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
494 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
495 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
496 01  ,01  ,01  ,01  ,01  ,01  ,01  ,01  ,
497 0};
498 char yyextra[] ={
499 0,0,0,0,0,0,0,0,
500 0,0,0,0,0,0,0,0,
501 0};
502 /*	ncform	4.1	83/08/11	*/
503 
504 int yylineno =1;
505 # define YYU(x) x
506 # define NLSTATE yyprevious=YYNEWLINE
507 char yytext[YYLMAX];
508 struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
509 char yysbuf[YYLMAX];
510 char *yysptr = yysbuf;
511 int *yyfnd;
512 extern struct yysvf *yyestate;
513 int yyprevious = YYNEWLINE;
yylook()514 static int yylook(){
515 	register struct yysvf *yystate, **lsp;
516 	register struct yywork *yyt;
517 	struct yysvf *yyz;
518 	int yych;
519 	struct yywork *yyr;
520 # ifdef LEXDEBUG
521 	int debug;
522 # endif
523 	char *yylastch;
524 	if (yyin == NULL) yyin = stdin;
525 	if (yyout == NULL) yyout = stdout;
526 	/* start off machines */
527 # ifdef LEXDEBUG
528 	debug = 0;
529 # endif
530 	if (!yymorfg)
531 		yylastch = yytext;
532 	else {
533 		yymorfg=0;
534 		yylastch = yytext+yyleng;
535 		}
536 	for(;;){
537 		lsp = yylstate;
538 		yyestate = yystate = yybgin;
539 		if (yyprevious==YYNEWLINE) yystate++;
540 		for (;;){
541 # ifdef LEXDEBUG
542 			if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
543 # endif
544 			yyt = yystate->yystoff;
545 			if(yyt == yycrank){		/* may not be any transitions */
546 				yyz = yystate->yyother;
547 				if(yyz == 0)break;
548 				if(yyz->yystoff == yycrank)break;
549 				}
550 			*yylastch++ = yych = input();
551 		tryagain:
552 # ifdef LEXDEBUG
553 			if(debug){
554 				fprintf(yyout,"unsigned char ");
555 				allprint(yych);
556 				putchar('\n');
557 				}
558 # endif
559 			yyr = yyt;
560 			if ( (long)yyt > (long)yycrank){
561 				yyt = yyr + yych;
562 				if (yyt <= yytop && yyt->verify+yysvec == yystate){
563 					if(yyt->advance+yysvec == YYLERR)	/* error transitions */
564 						{unput(*--yylastch);break;}
565 					*lsp++ = yystate = yyt->advance+yysvec;
566 					goto contin;
567 					}
568 				}
569 # ifdef YYOPTIM
570 			else if((long)yyt < (long)yycrank) {		/* r < yycrank */
571 				yyt = yyr = yycrank+(yycrank-yyt);
572 # ifdef LEXDEBUG
573 				if(debug)fprintf(yyout,"compressed state\n");
574 # endif
575 				yyt = yyt + yych;
576 				if(yyt <= yytop && yyt->verify+yysvec == yystate){
577 					if(yyt->advance+yysvec == YYLERR)	/* error transitions */
578 						{unput(*--yylastch);break;}
579 					*lsp++ = yystate = yyt->advance+yysvec;
580 					goto contin;
581 					}
582 				yyt = yyr + YYU(yymatch[yych]);
583 # ifdef LEXDEBUG
584 				if(debug){
585 					fprintf(yyout,"try fall back character ");
586 					allprint(YYU(yymatch[yych]));
587 					putchar('\n');
588 					}
589 # endif
590 				if(yyt <= yytop && yyt->verify+yysvec == yystate){
591 					if(yyt->advance+yysvec == YYLERR)	/* error transition */
592 						{unput(*--yylastch);break;}
593 					*lsp++ = yystate = yyt->advance+yysvec;
594 					goto contin;
595 					}
596 				}
597 			if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
598 # ifdef LEXDEBUG
599 				if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
600 # endif
601 				goto tryagain;
602 				}
603 # endif
604 			else
605 				{unput(*--yylastch);break;}
606 		contin:
607 # ifdef LEXDEBUG
608 			if(debug){
609 				fprintf(yyout,"state %d char ",yystate-yysvec-1);
610 				allprint(yych);
611 				putchar('\n');
612 				}
613 # endif
614 			;
615 			}
616 # ifdef LEXDEBUG
617 		if(debug){
618 			fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
619 			allprint(yych);
620 			putchar('\n');
621 			}
622 # endif
623 		while (lsp-- > yylstate){
624 			*yylastch-- = 0;
625 			if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
626 				yyolsp = lsp;
627 				if(yyextra[*yyfnd]){		/* must backup */
628 					while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
629 						lsp--;
630 						unput(*yylastch--);
631 						}
632 					}
633 				yyprevious = YYU(*yylastch);
634 				yylsp = lsp;
635 				yyleng = yylastch-yytext+1;
636 				yytext[yyleng] = 0;
637 # ifdef LEXDEBUG
638 				if(debug){
639 					fprintf(yyout,"\nmatch ");
640 					sprint(yytext);
641 					fprintf(yyout," action %d\n",*yyfnd);
642 					}
643 # endif
644 				return(*yyfnd++);
645 				}
646 			unput(*yylastch);
647 			}
648 		if (yytext[0] == 0  /* && feof(yyin) */)
649 			{
650 			yysptr=yysbuf;
651 			return(0);
652 			}
653 		yyprevious = yytext[0] = input();
654 		if (yyprevious>0)
655 			output(yyprevious);
656 		yylastch=yytext;
657 # ifdef LEXDEBUG
658 		if(debug)putchar('\n');
659 # endif
660 		}
661 	}
yyback(int * p,int m)662 static int yyback(int *p, int m)
663 {
664 if (p==0) return(0);
665 while (*p)
666 	{
667 	if (*p++ == m)
668 		return(1);
669 	}
670 return(0);
671 }
672 	/* the following are only used in the lex library */
yyinput()673 int yyinput(){
674 	if (yyin == NULL) yyin = stdin;
675 	return(input());
676 	}
yyoutput(c)677 void yyoutput(c)
678   int c; {
679 	if (yyout == NULL) yyout = stdout;
680 	output(c);
681 	}
yyunput(c)682 void yyunput(c)
683    int c; {
684 	unput(c);
685 	}
686