|
|
1.1 root 1: # include "stdio.h"
2: # define U(x) x
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 ={stdin}, *yyout ={stdout};
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: int skipping;
29: # define YYNEWLINE 10
30: yylex(){
31: int nstr; extern int yyprevious;
32: while((nstr = yylook()) >= 0)
33: yyfussy: switch(nstr){
34: case 0:
35: if(yywrap()) return(0); break;
36: case 1:
37: {skipping = 1;}
38: break;
39: case 2:
40: {skipping = 0;}
41: break;
42: case 3:
43: {extern int brkcount;
44: if (! skipping)
45: if (++brkcount == 2)
46: return(0); /* end-of-file */
47: else
48: return(DEFBRK);
49: }
50: break;
51: case 4:
52: {if (! skipping) return(COLON);}
53: break;
54: case 5:
55: {if (! skipping) return(OCTAL);}
56: break;
57: case 6:
58: {if (! skipping) return(INTEGER);}
59: break;
60: case 7:
61: {if (! skipping) return(IS);}
62: break;
63: case 8:
64: {if (! skipping) return(ON);}
65: break;
66: case 9:
67: ;
68: break;
69: case 10:
70: {if (! skipping) return(IINT);}
71: break;
72: case 11:
73: {if (! skipping) return(IINT);}
74: break;
75: case 12:
76: {if (! skipping) return(OINT);}
77: break;
78: case 13:
79: {if (! skipping) return(OINT);}
80: break;
81: case 14:
82: {if (! skipping) return(CSR);}
83: break;
84: case 15:
85: {if (! skipping) return(CSR);}
86: break;
87: case 16:
88: {if (! skipping) return(IVEC);}
89: break;
90: case 17:
91: {if (! skipping) return(IVEC);}
92: break;
93: case 18:
94: {if (! skipping) return(OVEC);}
95: break;
96: case 19:
97: {if (! skipping) return(OVEC);}
98: break;
99: case 20:
100: {if (! skipping) return(INIT);}
101: break;
102: case 21:
103: {if (! skipping) return(INIT);}
104: break;
105: case 22:
106: {if (! skipping) return(OPEN);}
107: break;
108: case 23:
109: {if (! skipping) return(OPEN);}
110: break;
111: case 24:
112: {if (! skipping) return(CLOSE);}
113: break;
114: case 25:
115: {if (! skipping) return(CLOSE);}
116: break;
117: case 26:
118: {if (! skipping) return(READ);}
119: break;
120: case 27:
121: {if (! skipping) return(READ);}
122: break;
123: case 28:
124: {if (! skipping) return(GETC);}
125: break;
126: case 29:
127: {if (! skipping) return(GETC);}
128: break;
129: case 30:
130: {if (! skipping) return(PUTC);}
131: break;
132: case 31:
133: {if (! skipping) return(PUTC);}
134: break;
135: case 32:
136: {if (! skipping) return(WRITE);}
137: break;
138: case 33:
139: {if (! skipping) return(WRITE);}
140: break;
141: case 34:
142: {if (! skipping) return(SEEK);}
143: break;
144: case 35:
145: {if (! skipping) return(SEEK);}
146: break;
147: case 36:
148: {if (! skipping) return(CNTL);}
149: break;
150: case 37:
151: {if (! skipping) return(CNTL);}
152: break;
153: case 38:
154: ;
155: break;
156: case 39:
157: {extern int linectr;
158: linectr++;
159: }
160: break;
161: case 40:
162: {if (! skipping) return(IDENT);}
163: break;
164: case 41:
165: {if (! skipping) return(yytext[0]);}
166: break;
167: case -1:
168: break;
169: default:
170: fprintf(yyout,"bad switch yylook %d",nstr);
171: } return(0); }
172: /* end of yylex */
173: int yyvstop[] ={
174: 0,
175:
176: 41,
177: 0,
178:
179: 38,
180: 41,
181: 0,
182:
183: 39,
184: 0,
185:
186: 3,
187: 41,
188: 0,
189:
190: 41,
191: 0,
192:
193: 41,
194: 0,
195:
196: 41,
197: 0,
198:
199: 5,
200: 41,
201: 0,
202:
203: 41,
204: 0,
205:
206: 4,
207: 41,
208: 0,
209:
210: 9,
211: 41,
212: 0,
213:
214: 40,
215: 41,
216: 0,
217:
218: 25,
219: 40,
220: 41,
221: 0,
222:
223: 29,
224: 40,
225: 41,
226: 0,
227:
228: 21,
229: 40,
230: 41,
231: 0,
232:
233: 37,
234: 40,
235: 41,
236: 0,
237:
238: 23,
239: 40,
240: 41,
241: 0,
242:
243: 31,
244: 40,
245: 41,
246: 0,
247:
248: 27,
249: 40,
250: 41,
251: 0,
252:
253: 35,
254: 40,
255: 41,
256: 0,
257:
258: 33,
259: 40,
260: 41,
261: 0,
262:
263: 38,
264: 0,
265:
266: 2,
267: 0,
268:
269: 24,
270: 0,
271:
272: 28,
273: 0,
274:
275: 20,
276: 0,
277:
278: 36,
279: 0,
280:
281: 22,
282: 0,
283:
284: 30,
285: 0,
286:
287: 26,
288: 0,
289:
290: 34,
291: 0,
292:
293: 32,
294: 0,
295:
296: 1,
297: 0,
298:
299: 5,
300: 0,
301:
302: 6,
303: 0,
304:
305: 40,
306: 0,
307:
308: 40,
309: 0,
310:
311: 40,
312: 0,
313:
314: 7,
315: 40,
316: 0,
317:
318: 40,
319: 0,
320:
321: 40,
322: 0,
323:
324: 8,
325: 40,
326: 0,
327:
328: 40,
329: 0,
330:
331: 15,
332: 40,
333: 0,
334:
335: 40,
336: 0,
337:
338: 40,
339: 0,
340:
341: 40,
342: 0,
343:
344: 40,
345: 0,
346:
347: 14,
348: 0,
349:
350: 10,
351: 40,
352: 0,
353:
354: 17,
355: 40,
356: 0,
357:
358: 12,
359: 40,
360: 0,
361:
362: 19,
363: 40,
364: 0,
365:
366: 11,
367: 0,
368:
369: 16,
370: 0,
371:
372: 13,
373: 0,
374:
375: 18,
376: 0,
377: 0};
378: # define YYTYPE char
379: struct yywork { YYTYPE verify, advance; } yycrank[] ={
380: 0,0, 0,0, 1,3, 0,0,
381: 0,0, 0,0, 0,0, 0,0,
382: 0,0, 0,0, 1,4, 1,5,
383: 0,0, 4,24, 0,0, 0,0,
384: 0,0, 0,0, 0,0, 0,0,
385: 0,0, 0,0, 0,0, 0,0,
386: 0,0, 0,0, 0,0, 0,0,
387: 0,0, 0,0, 0,0, 0,0,
388: 0,0, 0,0, 0,0, 0,0,
389: 4,24, 0,0, 1,6, 0,0,
390: 0,0, 0,0, 0,0, 1,7,
391: 0,0, 0,0, 1,8, 9,35,
392: 1,9, 1,10, 1,11, 7,25,
393: 0,0, 0,0, 0,0, 2,6,
394: 0,0, 0,0, 0,0, 1,12,
395: 2,7, 0,0, 1,13, 2,8,
396: 0,0, 2,9, 1,14, 0,0,
397: 0,0, 0,0, 0,0, 0,0,
398: 0,0, 0,0, 0,0, 0,0,
399: 2,12, 0,0, 0,0, 2,13,
400: 10,36, 10,36, 10,36, 10,36,
401: 10,36, 10,36, 10,36, 10,36,
402: 10,36, 10,36, 11,37, 11,37,
403: 11,37, 11,37, 11,37, 11,37,
404: 11,37, 11,37, 11,37, 11,37,
405: 1,15, 0,0, 0,0, 0,0,
406: 1,16, 0,0, 1,17, 0,0,
407: 0,0, 0,0, 0,0, 1,18,
408: 1,19, 1,20, 17,40, 1,21,
409: 1,22, 2,15, 42,53, 15,39,
410: 1,23, 2,16, 28,47, 2,17,
411: 17,41, 26,46, 19,43, 17,42,
412: 2,18, 2,19, 2,20, 19,44,
413: 2,21, 2,22, 8,26, 28,48,
414: 39,51, 2,23, 8,27, 19,45,
415: 8,28, 40,52, 43,54, 45,55,
416: 46,56, 8,29, 8,30, 8,31,
417: 47,57, 8,32, 8,33, 48,58,
418: 30,49, 49,59, 8,34, 14,38,
419: 14,38, 14,38, 14,38, 14,38,
420: 14,38, 14,38, 14,38, 14,38,
421: 14,38, 30,50, 50,60, 52,61,
422: 53,62, 54,63, 55,64, 57,65,
423: 14,38, 14,38, 14,38, 14,38,
424: 14,38, 14,38, 14,38, 14,38,
425: 14,38, 14,38, 14,38, 14,38,
426: 14,38, 14,38, 14,38, 14,38,
427: 14,38, 14,38, 14,38, 14,38,
428: 14,38, 14,38, 14,38, 14,38,
429: 14,38, 14,38, 58,66, 59,67,
430: 60,68, 0,0, 14,38, 0,0,
431: 14,38, 14,38, 14,38, 14,38,
432: 14,38, 14,38, 14,38, 14,38,
433: 14,38, 14,38, 14,38, 14,38,
434: 14,38, 14,38, 14,38, 14,38,
435: 14,38, 14,38, 14,38, 14,38,
436: 14,38, 14,38, 14,38, 14,38,
437: 14,38, 14,38, 0,0, 0,0,
438: 0,0};
439: struct yysvf yysvec[] ={
440: 0, 0, 0,
441: yycrank+-1, 0, 0,
442: yycrank+-18, yysvec+1, 0,
443: yycrank+0, 0, yyvstop+1,
444: yycrank+4, 0, yyvstop+3,
445: yycrank+0, 0, yyvstop+6,
446: yycrank+0, 0, yyvstop+8,
447: yycrank+4, 0, yyvstop+11,
448: yycrank+35, 0, yyvstop+13,
449: yycrank+5, 0, yyvstop+15,
450: yycrank+32, 0, yyvstop+17,
451: yycrank+42, 0, yyvstop+20,
452: yycrank+0, 0, yyvstop+22,
453: yycrank+0, 0, yyvstop+25,
454: yycrank+107, 0, yyvstop+28,
455: yycrank+4, yysvec+14, yyvstop+31,
456: yycrank+0, yysvec+14, yyvstop+35,
457: yycrank+9, yysvec+14, yyvstop+39,
458: yycrank+0, yysvec+14, yyvstop+43,
459: yycrank+21, yysvec+14, yyvstop+47,
460: yycrank+0, yysvec+14, yyvstop+51,
461: yycrank+0, yysvec+14, yyvstop+55,
462: yycrank+0, yysvec+14, yyvstop+59,
463: yycrank+0, yysvec+14, yyvstop+63,
464: yycrank+0, yysvec+4, yyvstop+67,
465: yycrank+0, 0, yyvstop+69,
466: yycrank+10, 0, yyvstop+71,
467: yycrank+0, 0, yyvstop+73,
468: yycrank+17, 0, yyvstop+75,
469: yycrank+0, 0, yyvstop+77,
470: yycrank+47, 0, yyvstop+79,
471: yycrank+0, 0, yyvstop+81,
472: yycrank+0, 0, yyvstop+83,
473: yycrank+0, 0, yyvstop+85,
474: yycrank+0, 0, yyvstop+87,
475: yycrank+0, 0, yyvstop+89,
476: yycrank+0, yysvec+10, yyvstop+91,
477: yycrank+0, yysvec+11, yyvstop+93,
478: yycrank+0, yysvec+14, yyvstop+95,
479: yycrank+22, yysvec+14, yyvstop+97,
480: yycrank+31, yysvec+14, yyvstop+99,
481: yycrank+0, yysvec+14, yyvstop+101,
482: yycrank+17, yysvec+14, yyvstop+104,
483: yycrank+32, yysvec+14, yyvstop+106,
484: yycrank+0, yysvec+14, yyvstop+108,
485: yycrank+42, yysvec+14, yyvstop+111,
486: yycrank+30, 0, 0,
487: yycrank+38, 0, 0,
488: yycrank+50, 0, 0,
489: yycrank+43, 0, 0,
490: yycrank+65, 0, 0,
491: yycrank+0, yysvec+14, yyvstop+113,
492: yycrank+51, yysvec+14, yyvstop+116,
493: yycrank+69, yysvec+14, yyvstop+118,
494: yycrank+53, yysvec+14, yyvstop+120,
495: yycrank+71, yysvec+14, yyvstop+122,
496: yycrank+0, 0, yyvstop+124,
497: yycrank+55, 0, 0,
498: yycrank+99, 0, 0,
499: yycrank+83, 0, 0,
500: yycrank+101, 0, 0,
501: yycrank+0, yysvec+14, yyvstop+126,
502: yycrank+0, yysvec+14, yyvstop+129,
503: yycrank+0, yysvec+14, yyvstop+132,
504: yycrank+0, yysvec+14, yyvstop+135,
505: yycrank+0, 0, yyvstop+138,
506: yycrank+0, 0, yyvstop+140,
507: yycrank+0, 0, yyvstop+142,
508: yycrank+0, 0, yyvstop+144,
509: 0, 0, 0};
510: struct yywork *yytop = yycrank+229;
511: struct yysvf *yybgin = yysvec+1;
512: char yymatch[] ={
513: 00 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
514: 01 ,011 ,012 ,01 ,01 ,01 ,01 ,01 ,
515: 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
516: 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
517: 011 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
518: 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
519: '0' ,'1' ,'1' ,'1' ,'1' ,'1' ,'1' ,'1' ,
520: '1' ,'1' ,01 ,01 ,01 ,01 ,01 ,01 ,
521: 01 ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
522: 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
523: 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
524: 'A' ,'A' ,'A' ,01 ,01 ,01 ,01 ,'A' ,
525: 01 ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
526: 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
527: 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
528: 'A' ,'A' ,'A' ,01 ,01 ,01 ,01 ,01 ,
529: 0};
530: char yyextra[] ={
531: 0,0,0,0,0,0,0,0,
532: 0,0,0,0,0,0,0,0,
533: 0,0,0,0,0,0,0,0,
534: 0,0,0,0,0,0,0,0,
535: 0,0,0,0,0,0,0,0,
536: 0,0,0,0,0,0,0,0,
537: 0};
538: /* ncform 4.1 83/08/11 */
539:
540: int yylineno =1;
541: # define YYU(x) x
542: # define NLSTATE yyprevious=YYNEWLINE
543: char yytext[YYLMAX];
544: struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
545: char yysbuf[YYLMAX];
546: char *yysptr = yysbuf;
547: int *yyfnd;
548: extern struct yysvf *yyestate;
549: int yyprevious = YYNEWLINE;
550: yylook(){
551: register struct yysvf *yystate, **lsp;
552: register struct yywork *yyt;
553: struct yysvf *yyz;
554: int yych;
555: struct yywork *yyr;
556: # ifdef LEXDEBUG
557: int debug;
558: # endif
559: char *yylastch;
560: /* start off machines */
561: # ifdef LEXDEBUG
562: debug = 0;
563: # endif
564: if (!yymorfg)
565: yylastch = yytext;
566: else {
567: yymorfg=0;
568: yylastch = yytext+yyleng;
569: }
570: for(;;){
571: lsp = yylstate;
572: yyestate = yystate = yybgin;
573: if (yyprevious==YYNEWLINE) yystate++;
574: for (;;){
575: # ifdef LEXDEBUG
576: if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
577: # endif
578: yyt = yystate->yystoff;
579: if(yyt == yycrank){ /* may not be any transitions */
580: yyz = yystate->yyother;
581: if(yyz == 0)break;
582: if(yyz->yystoff == yycrank)break;
583: }
584: *yylastch++ = yych = input();
585: tryagain:
586: # ifdef LEXDEBUG
587: if(debug){
588: fprintf(yyout,"char ");
589: allprint(yych);
590: putchar('\n');
591: }
592: # endif
593: yyr = yyt;
594: if ( (int)yyt > (int)yycrank){
595: yyt = yyr + yych;
596: if (yyt <= yytop && yyt->verify+yysvec == yystate){
597: if(yyt->advance+yysvec == YYLERR) /* error transitions */
598: {unput(*--yylastch);break;}
599: *lsp++ = yystate = yyt->advance+yysvec;
600: goto contin;
601: }
602: }
603: # ifdef YYOPTIM
604: else if((int)yyt < (int)yycrank) { /* r < yycrank */
605: yyt = yyr = yycrank+(yycrank-yyt);
606: # ifdef LEXDEBUG
607: if(debug)fprintf(yyout,"compressed state\n");
608: # endif
609: yyt = yyt + yych;
610: if(yyt <= yytop && yyt->verify+yysvec == yystate){
611: if(yyt->advance+yysvec == YYLERR) /* error transitions */
612: {unput(*--yylastch);break;}
613: *lsp++ = yystate = yyt->advance+yysvec;
614: goto contin;
615: }
616: yyt = yyr + YYU(yymatch[yych]);
617: # ifdef LEXDEBUG
618: if(debug){
619: fprintf(yyout,"try fall back character ");
620: allprint(YYU(yymatch[yych]));
621: putchar('\n');
622: }
623: # endif
624: if(yyt <= yytop && yyt->verify+yysvec == yystate){
625: if(yyt->advance+yysvec == YYLERR) /* error transition */
626: {unput(*--yylastch);break;}
627: *lsp++ = yystate = yyt->advance+yysvec;
628: goto contin;
629: }
630: }
631: if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
632: # ifdef LEXDEBUG
633: if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
634: # endif
635: goto tryagain;
636: }
637: # endif
638: else
639: {unput(*--yylastch);break;}
640: contin:
641: # ifdef LEXDEBUG
642: if(debug){
643: fprintf(yyout,"state %d char ",yystate-yysvec-1);
644: allprint(yych);
645: putchar('\n');
646: }
647: # endif
648: ;
649: }
650: # ifdef LEXDEBUG
651: if(debug){
652: fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
653: allprint(yych);
654: putchar('\n');
655: }
656: # endif
657: while (lsp-- > yylstate){
658: *yylastch-- = 0;
659: if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
660: yyolsp = lsp;
661: if(yyextra[*yyfnd]){ /* must backup */
662: while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
663: lsp--;
664: unput(*yylastch--);
665: }
666: }
667: yyprevious = YYU(*yylastch);
668: yylsp = lsp;
669: yyleng = yylastch-yytext+1;
670: yytext[yyleng] = 0;
671: # ifdef LEXDEBUG
672: if(debug){
673: fprintf(yyout,"\nmatch ");
674: sprint(yytext);
675: fprintf(yyout," action %d\n",*yyfnd);
676: }
677: # endif
678: return(*yyfnd++);
679: }
680: unput(*yylastch);
681: }
682: if (yytext[0] == 0 /* && feof(yyin) */)
683: {
684: yysptr=yysbuf;
685: return(0);
686: }
687: yyprevious = yytext[0] = input();
688: if (yyprevious>0)
689: output(yyprevious);
690: yylastch=yytext;
691: # ifdef LEXDEBUG
692: if(debug)putchar('\n');
693: # endif
694: }
695: }
696: yyback(p, m)
697: int *p;
698: {
699: if (p==0) return(0);
700: while (*p)
701: {
702: if (*p++ == m)
703: return(1);
704: }
705: return(0);
706: }
707: /* the following are only used in the lex library */
708: yyinput(){
709: return(input());
710: }
711: yyoutput(c)
712: int c; {
713: output(c);
714: }
715: yyunput(c)
716: int c; {
717: unput(c);
718: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.