USG_PG3/usr/lex/cform

struct %ssvf *yylstate [YYLMAX], **yylsp, **yyolsp;
int *yyfnd, yymorfg, yyleng;
char yytext[YYLMAX];
struct %ssvf *yybgin yysvec+1;
int yyprevious YYNEWLINE;
%slook ()
{
register struct %ssvf *state, **lsp;
register struct %swork *r;
int ch, n;
char *yylastch;
/* start off machines */
if (!yymorfg)
        yylastch = yytext;
else
        {
        yymorfg=0;
        yylastch = yytext+yyleng-1;
        }
loop:
lsp = yylstate;
state = yybgin;
if (yyprevious==YYNEWLINE) state++;
for (;;)
        {
        if ((r = state->%sstoff) == 0)
                if((state= state->%sother) ==0)
                        break;
                else r = state->%sstoff;
        *yylastch++ = ch = input();
        tryagain:
        r =+ ch;
        if (r->verify == state)
                *lsp++ = state = r->advance;
        else
        if ((state = state->%sother) && (r= state->%sstoff))
                goto tryagain;
        else
                {
                unput(*--yylastch);
                break;
                }
        }
while (lsp-- > yylstate)
        {
        *yylastch-- = 0;
        if (*lsp != 0 && (yyfnd= (*lsp)->%sstops) && *yyfnd > 0)
                {
                yyolsp = lsp;
                if (yyextra[*yyfnd])
                        {
                        while (yyback((*lsp)->%sstops, -*yyfnd) != 1 && lsp>yylstate)
                                {
                                lsp--;
                                unput(*yylastch--);
                                }
                        }
                yyprevious = *yylastch;
                yylsp = lsp;
                yyleng = yylastch-yytext+1;
                yytext[yyleng] = 0;
                return(*yyfnd++);
                }
        unput(*yylastch);
        }
if (yytext[0] == 0)
        return(0);
output(yyprevious = input());
yylastch=yytext;
goto loop;
}
yyback(p, m)
        int *p;
{
if (p==0) return(0);
while (*p)
        {
        if (*p++ == m)
                return(1);
        }
return(0);
}