Commit | Line | Data |
---|---|---|
408c6ae3 | 1 | %{ |
b8c620d6 | 2 | |
528b0614 DF |
3 | /* |
4 | * Copyright (c) 1983 Regents of the University of California. | |
40d8a0c1 KB |
5 | * All rights reserved. |
6 | * | |
7 | * Redistribution and use in source and binary forms are permitted | |
b8c620d6 KB |
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. | |
528b0614 DF |
18 | */ |
19 | ||
20 | #ifndef lint | |
d61f36f1 | 21 | static char sccsid[] = "@(#)scan.l 5.7 (Berkeley) %G%"; |
40d8a0c1 | 22 | #endif /* not lint */ |
408c6ae3 | 23 | |
d61f36f1 KB |
24 | extern int yylineno; |
25 | int yylineno = 1; | |
26 | ||
408c6ae3 SL |
27 | #include "y.tab.h" |
28 | #include "htable.h" | |
29 | %} | |
30 | ||
31 | BLANK [ \t] | |
32 | DIGIT [0-9] | |
1b346527 MK |
33 | ALPHA [A-Za-z] |
34 | ANUM [0-9A-Za-z] | |
35 | NAMECHR [0-9A-Za-z./-] | |
408c6ae3 SL |
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 | ||
295f3778 RC |
58 | {ALPHA} { |
59 | yylval.namelist = newname(yytext); | |
60 | return (NAME); | |
61 | } | |
408c6ae3 | 62 | |
99973219 MK |
63 | {DIGIT}+{ALPHA}{NAMECHR}* { |
64 | fprintf(stderr, "Warning: nonstandard name \"%s\"\n", | |
65 | yytext); | |
66 | yylval.namelist = newname(yytext); | |
67 | return (NAME); | |
68 | } | |
69 | ||
408c6ae3 SL |
70 | {DIGIT}+ { |
71 | yylval.number = atoi(yytext); | |
72 | return (NUMBER); | |
73 | } | |
74 | ||
75 | "." return ('.'); | |
76 | ":" return (':'); | |
77 | "," return (','); | |
78 | "/" return ('/'); | |
79 | ";".* ; | |
d61f36f1 | 80 | "\n"{BLANK}+ ++yylineno; |
408c6ae3 | 81 | {BLANK}+ ; |
d61f36f1 | 82 | "\n" ++yylineno; return (END); |
408c6ae3 SL |
83 | . fprintf(stderr, "Illegal char: '%s'\n", yytext); |
84 | ||
85 | %% |