|
|
1.1 root 1: %{
2:
3: /*
4: * Copyright (c) 1983 Regents of the University of California.
5: * All rights reserved.
6: *
7: * Redistribution and use in source and binary forms are permitted
8: * provided that the above copyright notice and this paragraph are
9: * duplicated in all such forms and that any documentation,
10: * advertising materials, and other materials related to such
11: * distribution and use acknowledge that the software was developed
12: * by the University of California, Berkeley. The name of the
13: * University may not be used to endorse or promote products derived
14: * from this software without specific prior written permission.
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: */
19:
20: #ifndef lint
21: static char sccsid[] = "@(#)scan.l 5.7 (Berkeley) 6/25/90";
22: #endif /* not lint */
23:
24: extern int yylineno;
25: int yylineno = 1;
26:
27: #include "y.tab.h"
28: #include "htable.h"
29: %}
30:
31: BLANK [ \t]
32: DIGIT [0-9]
33: ALPHA [A-Za-z]
34: ANUM [0-9A-Za-z]
35: NAMECHR [0-9A-Za-z./-]
36:
37: %%
38: "NET" {
39: yylval.number = KW_NET;
40: return (KEYWORD);
41: }
42:
43: "GATEWAY" {
44: yylval.number = KW_GATEWAY;
45: return (KEYWORD);
46: }
47:
48: "HOST" {
49: yylval.number = KW_HOST;
50: return (KEYWORD);
51: }
52:
53: {ALPHA}{NAMECHR}*{ANUM} {
54: yylval.namelist = newname(yytext);
55: return (NAME);
56: }
57:
58: {ALPHA} {
59: yylval.namelist = newname(yytext);
60: return (NAME);
61: }
62:
63: {DIGIT}+{ALPHA}{NAMECHR}* {
64: fprintf(stderr, "Warning: nonstandard name \"%s\"\n",
65: yytext);
66: yylval.namelist = newname(yytext);
67: return (NAME);
68: }
69:
70: {DIGIT}+ {
71: yylval.number = atoi(yytext);
72: return (NUMBER);
73: }
74:
75: "." return ('.');
76: ":" return (':');
77: "," return (',');
78: "/" return ('/');
79: ";".* ;
80: "\n"{BLANK}+ ++yylineno;
81: {BLANK}+ ;
82: "\n" ++yylineno; return (END);
83: . fprintf(stderr, "Illegal char: '%s'\n", yytext);
84:
85: %%
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.