1 %{ 2 /* 3 * Copyright (c) 1983 Regents of the University of California. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms are permitted 7 * provided that this notice is preserved and that due credit is given 8 * to the University of California at Berkeley. The name of the University 9 * may not be used to endorse or promote products derived from this 10 * software without specific prior written permission. This software 11 * is provided ``as is'' without express or implied warranty. 12 */ 13 14 #ifndef lint 15 static char sccsid[] = "@(#)scan.l 5.5 (Berkeley) 02/23/88"; 16 #endif /* not lint */ 17 18 #include "y.tab.h" 19 #include "htable.h" 20 %} 21 22 BLANK [ \t] 23 DIGIT [0-9] 24 ALPHA [A-Za-z] 25 ANUM [0-9A-Za-z] 26 NAMECHR [0-9A-Za-z./-] 27 28 %% 29 "NET" { 30 yylval.number = KW_NET; 31 return (KEYWORD); 32 } 33 34 "GATEWAY" { 35 yylval.number = KW_GATEWAY; 36 return (KEYWORD); 37 } 38 39 "HOST" { 40 yylval.number = KW_HOST; 41 return (KEYWORD); 42 } 43 44 {ALPHA}{NAMECHR}*{ANUM} { 45 yylval.namelist = newname(yytext); 46 return (NAME); 47 } 48 49 {ALPHA} { 50 yylval.namelist = newname(yytext); 51 return (NAME); 52 } 53 54 {DIGIT}+{ALPHA}{NAMECHR}* { 55 fprintf(stderr, "Warning: nonstandard name \"%s\"\n", 56 yytext); 57 yylval.namelist = newname(yytext); 58 return (NAME); 59 } 60 61 {DIGIT}+ { 62 yylval.number = atoi(yytext); 63 return (NUMBER); 64 } 65 66 "." return ('.'); 67 ":" return (':'); 68 "," return (','); 69 "/" return ('/'); 70 ";".* ; 71 "\n"{BLANK}+ ; 72 {BLANK}+ ; 73 "\n" return (END); 74 . fprintf(stderr, "Illegal char: '%s'\n", yytext); 75 76 %% 77 78 yywrap() 79 { 80 return (1); 81 } 82