Annotation of researchv10no/cmd/lex/ncform, revision 1.1.1.1

1.1       root        1: int yylineno =1;
                      2: # define YYU(x) x
                      3: # define NLSTATE yyprevious=YYNEWLINE
                      4: char yytext[YYLMAX];
                      5: struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
                      6: char yysbuf[YYLMAX];
                      7: char *yysptr = yysbuf;
                      8: int *yyfnd;
                      9: extern struct yysvf *yyestate;
                     10: int yyprevious = YYNEWLINE;
                     11: yylook(){
                     12:        register struct yysvf *yystate, **lsp;
                     13:        register int yyt;
                     14:        register struct yywork *yyk;
                     15:        struct yysvf *yyz;
                     16:        int yych;
                     17:        int yyr;
                     18: # ifdef LEXDEBUG
                     19:        int debug;
                     20: # endif
                     21:        char *yylastch;
                     22:        /* start off machines */
                     23: # ifdef LEXDEBUG
                     24:        debug = 0;
                     25: # endif
                     26:        if (!yymorfg)
                     27:                yylastch = yytext;
                     28:        else {
                     29:                yymorfg=0;
                     30:                yylastch = yytext+yyleng;
                     31:                }
                     32:        for(;;){
                     33:                lsp = yylstate;
                     34:                yyestate = yystate = yybgin;
                     35:                if (yyprevious==YYNEWLINE) yystate++;
                     36:                for (;;){
                     37: # ifdef LEXDEBUG
                     38:                        if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
                     39: # endif
                     40:                        yyt = yystate->yystoff;
                     41:                        if(yyt == 0){           /* may not be any transitions */
                     42:                                yyz = yystate->yyother;
                     43:                                if(yyz == 0)break;
                     44:                                if(yyz->yystoff == 0)break;
                     45:                                }
                     46:                        *yylastch++ = yych = input();
                     47:                tryagain:
                     48: # ifdef LEXDEBUG
                     49:                        if(debug){
                     50:                                fprintf(yyout,"char ");
                     51:                                allprint(yych);
                     52:                                putchar('\n');
                     53:                                }
                     54: # endif
                     55:                        yyr = yyt;
                     56:                        if ( yyt > 0){
                     57:                                yyt = yyr + yych;
                     58:                                yyk = yycrank + yyt;
                     59:                                if (yyt <= yytop && yyk->verify+yysvec == yystate){
                     60:                                        if(yyk->advance+yysvec == YYLERR)       /* error transitions */
                     61:                                                {unput(*--yylastch);break;}
                     62:                                        *lsp++ = yystate = yyk->advance+yysvec;
                     63:                                        goto contin;
                     64:                                        }
                     65:                                }
                     66: # ifdef YYOPTIM
                     67:                        else if(yyt < 0) {              /* r < yycrank */
                     68:                                yyt = yyr = -yyt;
                     69: # ifdef LEXDEBUG
                     70:                                if(debug)fprintf(yyout,"compressed state\n");
                     71: # endif
                     72:                                yyt = yyt + yych;
                     73:                                yyk = yycrank + yyt;
                     74:                                if(yyt <= yytop && yyk->verify+yysvec == yystate){
                     75:                                        if(yyk->advance+yysvec == YYLERR)       /* error transitions */
                     76:                                                {unput(*--yylastch);break;}
                     77:                                        *lsp++ = yystate = yyk->advance+yysvec;
                     78:                                        goto contin;
                     79:                                        }
                     80:                                yyt = yyr + YYU(yymatch[yych]);
                     81:                                yyk = yycrank + yyt;
                     82: # ifdef LEXDEBUG
                     83:                                if(debug){
                     84:                                        fprintf(yyout,"try fall back character ");
                     85:                                        allprint(YYU(yymatch[yych]));
                     86:                                        putchar('\n');
                     87:                                        }
                     88: # endif
                     89:                                if(yyt <= yytop && yyk->verify+yysvec == yystate){
                     90:                                        if(yyk->advance+yysvec == YYLERR)       /* error transition */
                     91:                                                {unput(*--yylastch);break;}
                     92:                                        *lsp++ = yystate = yyk->advance+yysvec;
                     93:                                        goto contin;
                     94:                                        }
                     95:                                }
                     96:                        if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != 0){
                     97: # ifdef LEXDEBUG
                     98:                                if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
                     99: # endif
                    100:                                goto tryagain;
                    101:                                }
                    102: # endif
                    103:                        else
                    104:                                {unput(*--yylastch);break;}
                    105:                contin:
                    106: # ifdef LEXDEBUG
                    107:                        if(debug){
                    108:                                fprintf(yyout,"state %d char ",yystate-yysvec-1);
                    109:                                allprint(yych);
                    110:                                putchar('\n');
                    111:                                }
                    112: # endif
                    113:                        ;
                    114:                        }
                    115: # ifdef LEXDEBUG
                    116:                if(debug){
                    117:                        fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
                    118:                        allprint(yych);
                    119:                        putchar('\n');
                    120:                        }
                    121: # endif
                    122:                while (lsp-- > yylstate){
                    123:                        *yylastch-- = 0;
                    124:                        if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
                    125:                                yyolsp = lsp;
                    126:                                if(yyextra[*yyfnd]){            /* must backup */
                    127:                                        while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
                    128:                                                lsp--;
                    129:                                                unput(*yylastch--);
                    130:                                                }
                    131:                                        }
                    132:                                yyprevious = YYU(*yylastch);
                    133:                                yylsp = lsp;
                    134:                                yyleng = yylastch-yytext+1;
                    135:                                yytext[yyleng] = 0;
                    136: # ifdef LEXDEBUG
                    137:                                if(debug){
                    138:                                        fprintf(yyout,"\nmatch ");
                    139:                                        sprint(yytext);
                    140:                                        fprintf(yyout," action %d\n",*yyfnd);
                    141:                                        }
                    142: # endif
                    143:                                return(*yyfnd++);
                    144:                                }
                    145:                        unput(*yylastch);
                    146:                        }
                    147:                if (yytext[0] == 0  /* && feof(yyin) */)
                    148:                        {
                    149:                        yysptr=yysbuf;
                    150:                        return(0);
                    151:                        }
                    152:                yyprevious = yytext[0] = input();
                    153:                if (yyprevious>0)
                    154:                        output(yyprevious);
                    155:                yylastch=yytext;
                    156: # ifdef LEXDEBUG
                    157:                if(debug)putchar('\n');
                    158: # endif
                    159:                }
                    160:        }
                    161: #ifdef __cplusplus
                    162: yyback(int *p, int m)
                    163: #else
                    164: yyback(p, m)
                    165:        int *p;
                    166: #endif
                    167: {
                    168: if (p==0) return(0);
                    169: while (*p)
                    170:        {
                    171:        if (*p++ == m)
                    172:                return(1);
                    173:        }
                    174: return(0);
                    175: }
                    176:        /* the following are only used in the lex library */
                    177: yyinput(){
                    178:        return(input());
                    179:        }
                    180: #ifdef __cplusplus
                    181: yyoutput(int c)
                    182: #else
                    183: yyoutput(c)
                    184:   int c;
                    185: #endif
                    186: {
                    187:        output(c);
                    188:        }
                    189: #ifdef __cplusplus
                    190: yyunput(int c)
                    191: #else
                    192: yyunput(c)
                    193:    int c;
                    194: #endif
                    195: {
                    196:        unput(c);
                    197:        }

unix.superglobalmegacorp.com

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