|
|
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:
29: /*
30: * Copyright (c) 1983 Regents of the University of California.
31: * All rights reserved.
32: *
33: * Redistribution and use in source and binary forms are permitted
34: * provided that the above copyright notice and this paragraph are
35: * duplicated in all such forms and that any documentation,
36: * advertising materials, and other materials related to such
37: * distribution and use acknowledge that the software was developed
38: * by the University of California, Berkeley. The name of the
39: * University may not be used to endorse or promote products derived
40: * from this software without specific prior written permission.
41: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
42: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
43: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
44: */
45:
46: #ifndef lint
47: static char sccsid[] = "@(#)scan.l 5.6 (Berkeley) 6/18/88";
48: #endif /* not lint */
49:
50: #include "htable.h"
51: # define YYNEWLINE 10
52: yylex(){
53: int nstr; extern int yyprevious;
54: while((nstr = yylook()) >= 0)
55: yyfussy: switch(nstr){
56: case 0:
57: if(yywrap()) return(0); break;
58: case 1:
59: {
60: yylval.number = KW_NET;
61: return (KEYWORD);
62: }
63: break;
64: case 2:
65: {
66: yylval.number = KW_GATEWAY;
67: return (KEYWORD);
68: }
69: break;
70: case 3:
71: {
72: yylval.number = KW_HOST;
73: return (KEYWORD);
74: }
75: break;
76: case 4:
77: {
78: yylval.namelist = newname(yytext);
79: return (NAME);
80: }
81: break;
82: case 5:
83: {
84: yylval.namelist = newname(yytext);
85: return (NAME);
86: }
87: break;
88: case 6:
89: {
90: fprintf(stderr, "Warning: nonstandard name \"%s\"\n",
91: yytext);
92: yylval.namelist = newname(yytext);
93: return (NAME);
94: }
95: break;
96: case 7:
97: {
98: yylval.number = atoi(yytext);
99: return (NUMBER);
100: }
101: break;
102: case 8:
103: return ('.');
104: break;
105: case 9:
106: return (':');
107: break;
108: case 10:
109: return (',');
110: break;
111: case 11:
112: return ('/');
113: break;
114: case 12:
115: ;
116: break;
117: case 13:
118: ;
119: break;
120: case 14:
121: ;
122: break;
123: case 15:
124: return (END);
125: break;
126: case 16:
127: fprintf(stderr, "Illegal char: '%s'\n", yytext);
128: break;
129: case -1:
130: break;
131: default:
132: fprintf(yyout,"bad switch yylook %d",nstr);
133: } return(0); }
134: /* end of yylex */
135:
136: yywrap()
137: {
138: return (1);
139: }
140: int yyvstop[] = {
141: 0,
142:
143: 16,
144: 0,
145:
146: 14,
147: 16,
148: 0,
149:
150: 15,
151: 0,
152:
153: 10,
154: 16,
155: 0,
156:
157: 8,
158: 16,
159: 0,
160:
161: 11,
162: 16,
163: 0,
164:
165: 7,
166: 16,
167: 0,
168:
169: 9,
170: 16,
171: 0,
172:
173: 12,
174: 16,
175: 0,
176:
177: 5,
178: 16,
179: 0,
180:
181: 5,
182: 16,
183: 0,
184:
185: 5,
186: 16,
187: 0,
188:
189: 5,
190: 16,
191: 0,
192:
193: 14,
194: 0,
195:
196: 13,
197: 0,
198:
199: 7,
200: 0,
201:
202: 6,
203: 0,
204:
205: 12,
206: 0,
207:
208: 4,
209: 0,
210:
211: 4,
212: 0,
213:
214: 4,
215: 0,
216:
217: 4,
218: 0,
219:
220: 4,
221: 0,
222:
223: 4,
224: 0,
225:
226: 1,
227: 4,
228: 0,
229:
230: 4,
231: 0,
232:
233: 3,
234: 4,
235: 0,
236:
237: 4,
238: 0,
239:
240: 4,
241: 0,
242:
243: 2,
244: 4,
245: 0,
246: 0};
247: # define YYTYPE char
248: struct yywork { YYTYPE verify, advance; } yycrank[] = {
249: 0,0, 0,0, 1,3, 0,0,
250: 0,0, 0,0, 0,0, 11,20,
251: 0,0, 0,0, 1,4, 1,5,
252: 4,16, 5,17, 20,0, 11,20,
253: 11,0, 0,0, 0,0, 0,0,
254: 0,0, 0,0, 0,0, 0,0,
255: 0,0, 0,0, 0,0, 0,0,
256: 0,0, 0,0, 0,0, 0,0,
257: 0,0, 0,0, 0,0, 4,16,
258: 5,17, 0,0, 0,0, 0,0,
259: 0,0, 0,0, 0,0, 0,0,
260: 0,0, 1,6, 1,3, 1,7,
261: 1,8, 1,9, 2,6, 11,20,
262: 2,7, 2,8, 11,20, 0,0,
263: 0,0, 0,0, 0,0, 1,10,
264: 1,11, 0,0, 0,0, 0,0,
265: 2,10, 2,11, 1,12, 13,23,
266: 31,32, 0,0, 15,25, 11,20,
267: 1,13, 1,14, 26,29, 0,0,
268: 0,0, 2,13, 2,14, 1,15,
269: 14,24, 0,0, 0,0, 0,0,
270: 2,15, 9,18, 9,18, 9,18,
271: 9,18, 9,18, 9,18, 9,18,
272: 9,18, 9,18, 9,18, 23,26,
273: 24,27, 25,28, 27,30, 29,31,
274: 32,33, 0,0, 9,19, 9,19,
275: 9,19, 9,19, 9,19, 9,19,
276: 9,19, 9,19, 9,19, 9,19,
277: 9,19, 9,19, 9,19, 9,19,
278: 9,19, 9,19, 9,19, 9,19,
279: 9,19, 9,19, 9,19, 9,19,
280: 9,19, 9,19, 9,19, 9,19,
281: 0,0, 0,0, 0,0, 0,0,
282: 0,0, 0,0, 9,19, 9,19,
283: 9,19, 9,19, 9,19, 9,19,
284: 9,19, 9,19, 9,19, 9,19,
285: 9,19, 9,19, 9,19, 9,19,
286: 9,19, 9,19, 9,19, 9,19,
287: 9,19, 9,19, 9,19, 9,19,
288: 9,19, 9,19, 9,19, 9,19,
289: 12,21, 12,21, 12,21, 12,22,
290: 12,22, 12,22, 12,22, 12,22,
291: 12,22, 12,22, 12,22, 12,22,
292: 12,22, 0,0, 0,0, 0,0,
293: 0,0, 0,0, 0,0, 0,0,
294: 12,22, 12,22, 12,22, 12,22,
295: 12,22, 12,22, 12,22, 12,22,
296: 12,22, 12,22, 12,22, 12,22,
297: 12,22, 12,22, 12,22, 12,22,
298: 12,22, 12,22, 12,22, 12,22,
299: 12,22, 12,22, 12,22, 12,22,
300: 12,22, 12,22, 0,0, 0,0,
301: 0,0, 0,0, 0,0, 0,0,
302: 12,22, 12,22, 12,22, 12,22,
303: 12,22, 12,22, 12,22, 12,22,
304: 12,22, 12,22, 12,22, 12,22,
305: 12,22, 12,22, 12,22, 12,22,
306: 12,22, 12,22, 12,22, 12,22,
307: 12,22, 12,22, 12,22, 12,22,
308: 12,22, 12,22, 19,19, 19,19,
309: 19,19, 19,19, 19,19, 19,19,
310: 19,19, 19,19, 19,19, 19,19,
311: 19,19, 19,19, 19,19, 0,0,
312: 0,0};
313: struct yysvf yysvec[] = {
314: 0, 0, 0,
315: yycrank+-1, 0, 0,
316: yycrank+-6, yysvec+1, 0,
317: yycrank+0, 0, yyvstop+1,
318: yycrank+3, 0, yyvstop+3,
319: yycrank+4, 0, yyvstop+6,
320: yycrank+0, 0, yyvstop+8,
321: yycrank+0, 0, yyvstop+11,
322: yycrank+0, 0, yyvstop+14,
323: yycrank+37, 0, yyvstop+17,
324: yycrank+0, 0, yyvstop+20,
325: yycrank+-6, 0, yyvstop+23,
326: yycrank+115, 0, yyvstop+26,
327: yycrank+2, yysvec+12, yyvstop+29,
328: yycrank+1, yysvec+12, yyvstop+32,
329: yycrank+1, yysvec+12, yyvstop+35,
330: yycrank+0, yysvec+4, yyvstop+38,
331: yycrank+0, yysvec+5, yyvstop+40,
332: yycrank+0, yysvec+9, yyvstop+42,
333: yycrank+193, yysvec+9, yyvstop+44,
334: yycrank+-4, yysvec+11, yyvstop+46,
335: yycrank+0, yysvec+12, 0,
336: yycrank+0, yysvec+12, yyvstop+48,
337: yycrank+11, yysvec+12, yyvstop+50,
338: yycrank+13, yysvec+12, yyvstop+52,
339: yycrank+13, yysvec+12, yyvstop+54,
340: yycrank+5, yysvec+12, yyvstop+56,
341: yycrank+14, yysvec+12, yyvstop+58,
342: yycrank+0, yysvec+12, yyvstop+60,
343: yycrank+12, yysvec+12, yyvstop+63,
344: yycrank+0, yysvec+12, yyvstop+65,
345: yycrank+3, yysvec+12, yyvstop+68,
346: yycrank+11, yysvec+12, yyvstop+70,
347: yycrank+0, yysvec+12, yyvstop+72,
348: 0, 0, 0};
349: struct yywork *yytop = yycrank+250;
350: struct yysvf *yybgin = yysvec+1;
351: char yymatch[] = {
352: 00 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
353: 01 ,011 ,012 ,01 ,01 ,01 ,01 ,01 ,
354: 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
355: 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
356: 011 ,01 ,01 ,01 ,01 ,01 ,01 ,01 ,
357: 01 ,01 ,01 ,01 ,01 ,'-' ,'-' ,'-' ,
358: '0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,
359: '0' ,'0' ,01 ,01 ,01 ,01 ,01 ,01 ,
360: 01 ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
361: 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
362: 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
363: 'A' ,'A' ,'A' ,01 ,01 ,01 ,01 ,01 ,
364: 01 ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
365: 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
366: 'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,'A' ,
367: 'A' ,'A' ,'A' ,01 ,01 ,01 ,01 ,01 ,
368: 0};
369: char yyextra[] = {
370: 0,0,0,0,0,0,0,0,
371: 0,0,0,0,0,0,0,0,
372: 0,0,0,0,0,0,0,0,
373: 0};
374: int yylineno =1;
375: # define YYU(x) x
376: # define NLSTATE yyprevious=YYNEWLINE
377: char yytext[YYLMAX];
378: struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
379: char yysbuf[YYLMAX];
380: char *yysptr = yysbuf;
381: int *yyfnd;
382: extern struct yysvf *yyestate;
383: int yyprevious = YYNEWLINE;
384: yylook(){
385: register struct yysvf *yystate, **lsp;
386: register struct yywork *yyt;
387: struct yysvf *yyz;
388: int yych;
389: struct yywork *yyr;
390: # ifdef LEXDEBUG
391: int debug;
392: # endif
393: char *yylastch;
394: /* start off machines */
395: # ifdef LEXDEBUG
396: debug = 0;
397: # endif
398: if (!yymorfg)
399: yylastch = yytext;
400: else {
401: yymorfg=0;
402: yylastch = yytext+yyleng;
403: }
404: for(;;){
405: lsp = yylstate;
406: yyestate = yystate = yybgin;
407: if (yyprevious==YYNEWLINE) yystate++;
408: for (;;){
409: # ifdef LEXDEBUG
410: if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
411: # endif
412: yyt = yystate->yystoff;
413: if(yyt == yycrank){ /* may not be any transitions */
414: yyz = yystate->yyother;
415: if(yyz == 0)break;
416: if(yyz->yystoff == yycrank)break;
417: }
418: *yylastch++ = yych = input();
419: tryagain:
420: # ifdef LEXDEBUG
421: if(debug){
422: fprintf(yyout,"char ");
423: allprint(yych);
424: putchar('\n');
425: }
426: # endif
427: yyr = yyt;
428: if ( (int)yyt > (int)yycrank){
429: yyt = yyr + yych;
430: if (yyt <= yytop && yyt->verify+yysvec == yystate){
431: if(yyt->advance+yysvec == YYLERR) /* error transitions */
432: {unput(*--yylastch);break;}
433: *lsp++ = yystate = yyt->advance+yysvec;
434: goto contin;
435: }
436: }
437: # ifdef YYOPTIM
438: else if((int)yyt < (int)yycrank) { /* r < yycrank */
439: yyt = yyr = yycrank+(yycrank-yyt);
440: # ifdef LEXDEBUG
441: if(debug)fprintf(yyout,"compressed state\n");
442: # endif
443: yyt = yyt + yych;
444: if(yyt <= yytop && yyt->verify+yysvec == yystate){
445: if(yyt->advance+yysvec == YYLERR) /* error transitions */
446: {unput(*--yylastch);break;}
447: *lsp++ = yystate = yyt->advance+yysvec;
448: goto contin;
449: }
450: yyt = yyr + YYU(yymatch[yych]);
451: # ifdef LEXDEBUG
452: if(debug){
453: fprintf(yyout,"try fall back character ");
454: allprint(YYU(yymatch[yych]));
455: putchar('\n');
456: }
457: # endif
458: if(yyt <= yytop && yyt->verify+yysvec == yystate){
459: if(yyt->advance+yysvec == YYLERR) /* error transition */
460: {unput(*--yylastch);break;}
461: *lsp++ = yystate = yyt->advance+yysvec;
462: goto contin;
463: }
464: }
465: if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
466: # ifdef LEXDEBUG
467: if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
468: # endif
469: goto tryagain;
470: }
471: # endif
472: else
473: {unput(*--yylastch);break;}
474: contin:
475: # ifdef LEXDEBUG
476: if(debug){
477: fprintf(yyout,"state %d char ",yystate-yysvec-1);
478: allprint(yych);
479: putchar('\n');
480: }
481: # endif
482: ;
483: }
484: # ifdef LEXDEBUG
485: if(debug){
486: fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
487: allprint(yych);
488: putchar('\n');
489: }
490: # endif
491: while (lsp-- > yylstate){
492: *yylastch-- = 0;
493: if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
494: yyolsp = lsp;
495: if(yyextra[*yyfnd]){ /* must backup */
496: while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
497: lsp--;
498: unput(*yylastch--);
499: }
500: }
501: yyprevious = YYU(*yylastch);
502: yylsp = lsp;
503: yyleng = yylastch-yytext+1;
504: yytext[yyleng] = 0;
505: # ifdef LEXDEBUG
506: if(debug){
507: fprintf(yyout,"\nmatch ");
508: sprint(yytext);
509: fprintf(yyout," action %d\n",*yyfnd);
510: }
511: # endif
512: return(*yyfnd++);
513: }
514: unput(*yylastch);
515: }
516: if (yytext[0] == 0 /* && feof(yyin) */)
517: {
518: yysptr=yysbuf;
519: return(0);
520: }
521: yyprevious = yytext[0] = input();
522: if (yyprevious>0)
523: output(yyprevious);
524: yylastch=yytext;
525: # ifdef LEXDEBUG
526: if(debug)putchar('\n');
527: # endif
528: }
529: }
530: yyback(p, m)
531: int *p;
532: {
533: if (p==0) return(0);
534: while (*p)
535: {
536: if (*p++ == m)
537: return(1);
538: }
539: return(0);
540: }
541: /* the following are only used in the lex library */
542: yyinput(){
543: return(input());
544: }
545: yyoutput(c)
546: int c; {
547: output(c);
548: }
549: yyunput(c)
550: int c; {
551: unput(c);
552: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.