xref: /csrg-svn/old/htable/scan.l (revision 43883)
18735Ssam %{
234773Sbostic 
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
834773Sbostic  * provided that the above copyright notice and this paragraph are
934773Sbostic  * duplicated in all such forms and that any documentation,
1034773Sbostic  * advertising materials, and other materials related to such
1134773Sbostic  * distribution and use acknowledge that the software was developed
1234773Sbostic  * by the University of California, Berkeley.  The name of the
1334773Sbostic  * University may not be used to endorse or promote products derived
1434773Sbostic  * from this software without specific prior written permission.
1534773Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1634773Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1734773Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1821132Sdist  */
1921132Sdist 
208735Ssam #ifndef lint
21*43883Sbostic static char sccsid[] = "@(#)scan.l	5.7 (Berkeley) 06/25/90";
2233538Sbostic #endif /* not lint */
238735Ssam 
24*43883Sbostic extern int yylineno;
25*43883Sbostic int yylineno = 1;
26*43883Sbostic 
278735Ssam #include "y.tab.h"
288735Ssam #include "htable.h"
298735Ssam %}
308735Ssam 
318735Ssam BLANK	[ \t]
328735Ssam DIGIT	[0-9]
3327090Skarels ALPHA	[A-Za-z]
3427090Skarels ANUM	[0-9A-Za-z]
3527090Skarels NAMECHR	[0-9A-Za-z./-]
368735Ssam 
378735Ssam %%
388735Ssam "NET"		{
398735Ssam 			yylval.number = KW_NET;
408735Ssam 			return (KEYWORD);
418735Ssam 		}
428735Ssam 
438735Ssam "GATEWAY"	{
448735Ssam 			yylval.number = KW_GATEWAY;
458735Ssam 			return (KEYWORD);
468735Ssam 		}
478735Ssam 
488735Ssam "HOST"		{
498735Ssam 			yylval.number = KW_HOST;
508735Ssam 			return (KEYWORD);
518735Ssam 		}
528735Ssam 
538735Ssam {ALPHA}{NAMECHR}*{ANUM}	{
548735Ssam 			yylval.namelist = newname(yytext);
558735Ssam 			return (NAME);
568735Ssam 		}
578735Ssam 
5818111Sralph {ALPHA}		{
5918111Sralph 			yylval.namelist = newname(yytext);
6018111Sralph 			return (NAME);
6118111Sralph 		}
628735Ssam 
6327189Skarels {DIGIT}+{ALPHA}{NAMECHR}* {
6427189Skarels 			fprintf(stderr, "Warning: nonstandard name \"%s\"\n",
6527189Skarels 				yytext);
6627189Skarels 			yylval.namelist = newname(yytext);
6727189Skarels 			return (NAME);
6827189Skarels 		}
6927189Skarels 
708735Ssam {DIGIT}+	{
718735Ssam 			yylval.number = atoi(yytext);
728735Ssam 			return (NUMBER);
738735Ssam 		}
748735Ssam 
758735Ssam "."		return ('.');
768735Ssam ":"		return (':');
778735Ssam ","		return (',');
788735Ssam "/"		return ('/');
798735Ssam ";".*		;
80*43883Sbostic "\n"{BLANK}+	++yylineno;
818735Ssam {BLANK}+	;
82*43883Sbostic "\n"		++yylineno; return (END);
838735Ssam .		fprintf(stderr, "Illegal char: '%s'\n", yytext);
848735Ssam 
858735Ssam %%
86