USG_PG3/usr/source/lexgen1/defst.c

# include "../lexgen1/ldefs.c"

int stgate 0;
defst()
{
char sp[100], *s;
char tp[20], *t;

lgate();
if (stgate++ == 0)
	printf(output, ratfor ?
		"define BEGIN yybgin=1+\n" :
		"# define BEGIN yybgin=yysvec+1+\n");
gets(s=sp);

while (*s && index(*s, " \t,") < 0)
	s++;

while (*s)
	{
	t = tp;
	while (*s && index(*s, " \t,") >= 0)
		s++;
	while(*s && index(*s, " \t,") < 0)
		*t++ = *s++;
	*t=0;
	if (t>tp)
		{
		printf(output, "%s define %s %d\n",ratfor?"":"#", tp, nstate-1);
		startnam(tp)->ii = nstate;
		nstate =+ 2;
		}
	}
}