File:  [Research Unix] / researchv10no / cmd / ap / apkeys / dlex.l
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

%%
[-'A-Za-z0-9#]+	{lcase(yytext);yylval=svc(sufstr(yytext)); return(WORD);}
"!"	return(NEG);
","	return(COMMA);
"."	return(DOT);
"*H"	return(HEAD);
"*P"	return(PARA);
"*S"	return(STORY);
">".*	{yylval=svc(yytext); return(WRITE);}
">>".*	{yylval=svc(yytext); return(APPEND);}
"|".*	{yylval=svc(yytext); return(PIPE);}
\n	return(NL);
.	;
%%
yyerror(s)
{
extern char *infile;
fprintf(stderr, "%s\n", s);
fprintf(stderr, "Bad input spec file %s line %d\n", infile, yylineno);
}
yywrap()
{
return(1); /* always stop on eof */
}
char *
svc(s)
	char *s;
{
char *p, *calloc();
p = calloc(strlen(s)+1,1);
assert(p!=0);
strcpy(p,s);
return(p);
}
lcase(s)
	register char *s;
{
register int c;
register char *p;
if (*s==0) return;
for(p=s+1; c= *p; p++)
	if (isupper(c))
		return;
if (isupper( c = *s))
	*s = tolower(c);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.