xref: /csrg-svn/old/htable/scan.l (revision 34773)
18735Ssam %{
2*34773Sbostic 
321132Sdist /*
421132Sdist  * Copyright (c) 1983 Regents of the University of California.
533538Sbostic  * All rights reserved.
633538Sbostic  *
733538Sbostic  * Redistribution and use in source and binary forms are permitted
8*34773Sbostic  * provided that the above copyright notice and this paragraph are
9*34773Sbostic  * duplicated in all such forms and that any documentation,
10*34773Sbostic  * advertising materials, and other materials related to such
11*34773Sbostic  * distribution and use acknowledge that the software was developed
12*34773Sbostic  * by the University of California, Berkeley.  The name of the
13*34773Sbostic  * University may not be used to endorse or promote products derived
14*34773Sbostic  * from this software without specific prior written permission.
15*34773Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16*34773Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17*34773Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1821132Sdist  */
1921132Sdist 
208735Ssam #ifndef lint
21*34773Sbostic static char sccsid[] = "@(#)scan.l	5.6 (Berkeley) 06/18/88";
2233538Sbostic #endif /* not lint */
238735Ssam 
248735Ssam #include "y.tab.h"
258735Ssam #include "htable.h"
268735Ssam %}
278735Ssam 
288735Ssam BLANK	[ \t]
298735Ssam DIGIT	[0-9]
3027090Skarels ALPHA	[A-Za-z]
3127090Skarels ANUM	[0-9A-Za-z]
3227090Skarels NAMECHR	[0-9A-Za-z./-]
338735Ssam 
348735Ssam %%
358735Ssam "NET"		{
368735Ssam 			yylval.number = KW_NET;
378735Ssam 			return (KEYWORD);
388735Ssam 		}
398735Ssam 
408735Ssam "GATEWAY"	{
418735Ssam 			yylval.number = KW_GATEWAY;
428735Ssam 			return (KEYWORD);
438735Ssam 		}
448735Ssam 
458735Ssam "HOST"		{
468735Ssam 			yylval.number = KW_HOST;
478735Ssam 			return (KEYWORD);
488735Ssam 		}
498735Ssam 
508735Ssam {ALPHA}{NAMECHR}*{ANUM}	{
518735Ssam 			yylval.namelist = newname(yytext);
528735Ssam 			return (NAME);
538735Ssam 		}
548735Ssam 
5518111Sralph {ALPHA}		{
5618111Sralph 			yylval.namelist = newname(yytext);
5718111Sralph 			return (NAME);
5818111Sralph 		}
598735Ssam 
6027189Skarels {DIGIT}+{ALPHA}{NAMECHR}* {
6127189Skarels 			fprintf(stderr, "Warning: nonstandard name \"%s\"\n",
6227189Skarels 				yytext);
6327189Skarels 			yylval.namelist = newname(yytext);
6427189Skarels 			return (NAME);
6527189Skarels 		}
6627189Skarels 
678735Ssam {DIGIT}+	{
688735Ssam 			yylval.number = atoi(yytext);
698735Ssam 			return (NUMBER);
708735Ssam 		}
718735Ssam 
728735Ssam "."		return ('.');
738735Ssam ":"		return (':');
748735Ssam ","		return (',');
758735Ssam "/"		return ('/');
768735Ssam ";".*		;
778735Ssam "\n"{BLANK}+	;
788735Ssam {BLANK}+	;
798735Ssam "\n"		return (END);
808735Ssam .		fprintf(stderr, "Illegal char: '%s'\n", yytext);
818735Ssam 
828735Ssam %%
838735Ssam 
848735Ssam yywrap()
858735Ssam {
868735Ssam 	return (1);
878735Ssam }
88