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.6 (Berkeley) 06/18/88"; 22 #endif /* not lint */ 23 24 #include "y.tab.h" 25 #include "htable.h" 26 %} 27 28 BLANK [ \t] 29 DIGIT [0-9] 30 ALPHA [A-Za-z] 31 ANUM [0-9A-Za-z] 32 NAMECHR [0-9A-Za-z./-] 33 34 %% 35 "NET" { 36 yylval.number = KW_NET; 37 return (KEYWORD); 38 } 39 40 "GATEWAY" { 41 yylval.number = KW_GATEWAY; 42 return (KEYWORD); 43 } 44 45 "HOST" { 46 yylval.number = KW_HOST; 47 return (KEYWORD); 48 } 49 50 {ALPHA}{NAMECHR}*{ANUM} { 51 yylval.namelist = newname(yytext); 52 return (NAME); 53 } 54 55 {ALPHA} { 56 yylval.namelist = newname(yytext); 57 return (NAME); 58 } 59 60 {DIGIT}+{ALPHA}{NAMECHR}* { 61 fprintf(stderr, "Warning: nonstandard name \"%s\"\n", 62 yytext); 63 yylval.namelist = newname(yytext); 64 return (NAME); 65 } 66 67 {DIGIT}+ { 68 yylval.number = atoi(yytext); 69 return (NUMBER); 70 } 71 72 "." return ('.'); 73 ":" return (':'); 74 "," return (','); 75 "/" return ('/'); 76 ";".* ; 77 "\n"{BLANK}+ ; 78 {BLANK}+ ; 79 "\n" return (END); 80 . fprintf(stderr, "Illegal char: '%s'\n", yytext); 81 82 %% 83 84 yywrap() 85 { 86 return (1); 87 } 88