Annotation of researchv10no/cmd/lex/y.tab.c, revision 1.1

1.1     ! root        1: # define CHAR 257
        !             2: # define CCL 258
        !             3: # define NCCL 259
        !             4: # define STR 260
        !             5: # define DELIM 261
        !             6: # define SCON 262
        !             7: # define ITER 263
        !             8: # define NEWE 264
        !             9: # define NULLS 265
        !            10: # define CAT 266
        !            11: 
        !            12: # line 11 "parser.y"
        !            13: #define YYSTYPE union _yystype_
        !            14: union _yystype_
        !            15: {
        !            16:        int     i;
        !            17:        char    *cp;
        !            18: };
        !            19: # include "ldefs.c"
        !            20: #define yyclearin yychar = -1
        !            21: #define yyerrok yyerrflag = 0
        !            22: extern int yychar;
        !            23: extern short yyerrflag;
        !            24: #ifndef YYMAXDEPTH
        !            25: #define YYMAXDEPTH 150
        !            26: #endif
        !            27: #ifndef YYSTYPE
        !            28: #define YYSTYPE int
        !            29: #endif
        !            30: YYSTYPE yylval, yyval;
        !            31: 
        !            32: # line 21 "parser.y"
        !            33: int i;
        !            34: int j,k;
        !            35: int g;
        !            36: char *p;
        !            37: # define YYERRCODE 256
        !            38: 
        !            39: # line 217 "parser.y"
        !            40: 
        !            41: yylex(){
        !            42:        register char *p;
        !            43:        register int c, i;
        !            44:        char  *t, *xp;
        !            45:        int n, j, k, x;
        !            46:        static int sectbegin;
        !            47:        static char token[TOKENSIZE];
        !            48:        static int iter;
        !            49: 
        !            50: # ifdef DEBUG
        !            51:        yylval.i = 0;
        !            52: # endif
        !            53: 
        !            54:        if(sect == DEFSECTION) {                /* definitions section */
        !            55:                while(!eof) {
        !            56:                        if(prev == '\n'){               /* next char is at beginning of line */
        !            57:                                getl(p=buf);
        !            58:                                switch(*p){
        !            59:                                case '%':
        !            60:                                        switch(c= *(p+1)){
        !            61:                                        case '%':
        !            62:                                                lgate();
        !            63:                                                if(!ratfor)fprintf(fout,"# ");
        !            64:                                                fprintf(fout,"define YYNEWLINE %d\n",ctable['\n']);
        !            65:                                                if(!ratfor)fprintf(fout,"yylex(){\nint nstr; extern int yyprevious;\n");
        !            66:                                                sectbegin = TRUE;
        !            67:                                                i = treesize*(sizeof(*name)+sizeof(*left)+
        !            68:                                                        sizeof(*right)+sizeof(*nullstr)+sizeof(*parent))+ALITTLEEXTRA;
        !            69:                                                c = (int)myalloc(i,1);
        !            70:                                                if(c == 0)
        !            71:                                                        error("Too little core for parse tree");
        !            72:                                                p = (char *)c;
        !            73:                                                cfree((char *)p,i,1);
        !            74:                                                name = (int *)myalloc(treesize,sizeof(*name));
        !            75:                                                left = (int *)myalloc(treesize,sizeof(*left));
        !            76:                                                right = (int *)myalloc(treesize,sizeof(*right));
        !            77:                                                nullstr = myalloc(treesize,sizeof(*nullstr));
        !            78:                                                parent = (int *)myalloc(treesize,sizeof(*parent));
        !            79:                                                if(name == 0 || left == 0 || right == 0 || parent == 0 || nullstr == 0)
        !            80:                                                        error("Too little core for parse tree");
        !            81:                                                return(freturn(DELIM));
        !            82:                                        case 'p': case 'P':     /* has overridden number of positions */
        !            83:                                                while(*p && !digit(*p))p++;
        !            84:                                                maxpos = siconv(p);
        !            85: # ifdef DEBUG
        !            86:                                                if (debug) printf("positions (%%p) now %d\n",maxpos);
        !            87: # endif
        !            88:                                                if(report == 2)report = 1;
        !            89:                                                continue;
        !            90:                                        case 'n': case 'N':     /* has overridden number of states */
        !            91:                                                while(*p && !digit(*p))p++;
        !            92:                                                nstates = siconv(p);
        !            93: # ifdef DEBUG
        !            94:                                                if(debug)printf( " no. states (%%n) now %d\n",nstates);
        !            95: # endif
        !            96:                                                if(report == 2)report = 1;
        !            97:                                                continue;
        !            98:                                        case 'e': case 'E':             /* has overridden number of tree nodes */
        !            99:                                                while(*p && !digit(*p))p++;
        !           100:                                                treesize = siconv(p);
        !           101: # ifdef DEBUG
        !           102:                                                if (debug) printf("treesize (%%e) now %d\n",treesize);
        !           103: # endif
        !           104:                                                if(report == 2)report = 1;
        !           105:                                                continue;
        !           106:                                        case 'o': case 'O':
        !           107:                                                while (*p && !digit(*p))p++;
        !           108:                                                outsize = siconv(p);
        !           109:                                                if (report ==2) report=1;
        !           110:                                                continue;
        !           111:                                        case 'a': case 'A':             /* has overridden number of transitions */
        !           112:                                                while(*p && !digit(*p))p++;
        !           113:                                                if(report == 2)report = 1;
        !           114:                                                ntrans = siconv(p);
        !           115: # ifdef DEBUG
        !           116:                                                if (debug)printf("N. trans (%%a) now %d\n",ntrans);
        !           117: # endif
        !           118:                                                continue;
        !           119:                                        case 'k': case 'K': /* overriden packed char classes */
        !           120:                                                while (*p && !digit(*p))p++;
        !           121:                                                if (report==2) report=1;
        !           122:                                                cfree((char *)pchar, pchlen, sizeof(*pchar));
        !           123:                                                pchlen = siconv(p);
        !           124: # ifdef DEBUG
        !           125:                                                if (debug) printf( "Size classes (%%k) now %d\n",pchlen);
        !           126: # endif
        !           127:                                                pchar=pcptr=myalloc(pchlen, sizeof(*pchar));
        !           128:                                                continue;
        !           129:                                        case 't': case 'T':     /* character set specifier */
        !           130:                                                ZCH = atoi(p+2);
        !           131:                                                if (ZCH < NCH) ZCH = NCH;
        !           132:                                                if (ZCH > 2*NCH) error("ch table needs redeclaration");
        !           133:                                                chset = TRUE;
        !           134:                                                for(i = 0; i<ZCH; i++)
        !           135:                                                        ctable[i] = 0;
        !           136:                                                while(getl(p) && scomp(p,"%T") != 0 && scomp(p,"%t") != 0){
        !           137:                                                        if((n = siconv(p)) <= 0 || n > ZCH){
        !           138:                                                                warning("Character value %d out of range",n);
        !           139:                                                                continue;
        !           140:                                                                }
        !           141:                                                        while(!space(*p) && *p) p++;
        !           142:                                                        while(space(*p)) p++;
        !           143:                                                        t = p;
        !           144:                                                        while(*t){
        !           145:                                                                c = ctrans(&t);
        !           146:                                                                if(ctable[c]){
        !           147:                                                                        if (printable(c))
        !           148:                                                                                warning("Character '%c' used twice",c);
        !           149:                                                                        else
        !           150:                                                                                warning("Character %o used twice",c);
        !           151:                                                                        }
        !           152:                                                                else ctable[c] = n;
        !           153:                                                                t++;
        !           154:                                                                }
        !           155:                                                        p = buf;
        !           156:                                                        }
        !           157:                                                {
        !           158:                                                char chused[2*NCH]; int kr;
        !           159:                                                for(i=0; i<ZCH; i++)
        !           160:                                                        chused[i]=0;
        !           161:                                                for(i=0; i<NCH; i++)
        !           162:                                                        chused[ctable[i]]=1;
        !           163:                                                for(kr=i=1; i<NCH; i++)
        !           164:                                                        if (ctable[i]==0)
        !           165:                                                                {
        !           166:                                                                while (chused[kr] == 0)
        !           167:                                                                        kr++;
        !           168:                                                                ctable[i]=kr;
        !           169:                                                                chused[kr]=1;
        !           170:                                                                }
        !           171:                                                }
        !           172:                                                lgate();
        !           173:                                                continue;
        !           174:                                        case 'r': case 'R':
        !           175:                                                c = 'r';
        !           176:                                        case 'c': case 'C':
        !           177:                                                if(lgatflg)
        !           178:                                                        error("Too late for language specifier");
        !           179:                                                ratfor = (c == 'r');
        !           180:                                                continue;
        !           181:                                        case '{':
        !           182:                                                lgate();
        !           183:                                                sharpline();
        !           184:                                                while(getl(p) && scomp(p,"%}") != 0)
        !           185:                                                        fprintf(fout, "%s\n",p);
        !           186:                                                if(p[0] == '%') continue;
        !           187:                                                error("Premature eof");
        !           188:                                        case 's': case 'S':             /* start conditions */
        !           189:                                                lgate();
        !           190:                                                while(*p && index(*p," \t,") < 0) p++;
        !           191:                                                n = TRUE;
        !           192:                                                while(n){
        !           193:                                                        while(*p && index(*p," \t,") >= 0) p++;
        !           194:                                                        t = p;
        !           195:                                                        while(*p && index(*p," \t,") < 0)p++;
        !           196:                                                        if(!*p) n = FALSE;
        !           197:                                                        *p++ = 0;
        !           198:                                                        if (*t == 0) continue;
        !           199:                                                        i = sptr*2;
        !           200:                                                        if(!ratfor)fprintf(fout,"# ");
        !           201:                                                        fprintf(fout,"define %s %d\n",t,i);
        !           202:                                                        scopy(t,sp);
        !           203:                                                        sname[sptr++] = sp;
        !           204:                                                        sname[sptr] = 0;        /* required by lookup */
        !           205:                                                        if(sptr >= STARTSIZE)
        !           206:                                                                error("Too many start conditions");
        !           207:                                                        sp += slength(sp) + 1;
        !           208:                                                        if(sp >= schar+STARTCHAR)
        !           209:                                                                error("Start conditions too long");
        !           210:                                                        }
        !           211:                                                continue;
        !           212:                                        default:
        !           213:                                                warning("Invalid request %s",p);
        !           214:                                                continue;
        !           215:                                                }       /* end of switch after seeing '%' */
        !           216:                                case ' ': case '\t':            /* must be code */
        !           217:                                        lgate();
        !           218:                                        fprintf(fout, "%s\n",p);
        !           219:                                        continue;
        !           220:                                default:                /* definition */
        !           221:                                        while(*p && !space(*p)) p++;
        !           222:                                        if(*p == 0)
        !           223:                                                continue;
        !           224:                                        prev = *p;
        !           225:                                        *p = 0;
        !           226:                                        bptr = p+1;
        !           227:                                        yylval.cp = buf;
        !           228:                                        if(digit(buf[0]))
        !           229:                                                warning("Substitution strings may not begin with digits");
        !           230:                                        return(freturn(STR));
        !           231:                                        }
        !           232:                                }
        !           233:                        /* still sect 1, but prev != '\n' */
        !           234:                        else {
        !           235:                                p = bptr;
        !           236:                                while(*p && space(*p)) p++;
        !           237:                                if(*p == 0)
        !           238:                                        warning("No translation given - null string assumed");
        !           239:                                scopy(p,token);
        !           240:                                yylval.cp = token;
        !           241:                                prev = '\n';
        !           242:                                return(freturn(STR));
        !           243:                                }
        !           244:                        }
        !           245:                /* end of section one processing */
        !           246:                }
        !           247:        else if(sect == RULESECTION){           /* rules and actions */
        !           248:                while(!eof){
        !           249:                        switch(c=gch()){
        !           250:                        case '\0':
        !           251:                                return(freturn(0));
        !           252:                        case '\n':
        !           253:                                if(prev == '\n') continue;
        !           254:                                x = NEWE;
        !           255:                                break;
        !           256:                        case ' ':
        !           257:                        case '\t':
        !           258:                                if(sectbegin == TRUE){
        !           259:                                        sharpline();
        !           260:                                        cpyact();
        !           261:                                        while((c=gch()) && c != '\n');
        !           262:                                        continue;
        !           263:                                        }
        !           264:                                if(!funcflag)phead2();
        !           265:                                funcflag = TRUE;
        !           266:                                if(ratfor)fprintf(fout,"%d\n",30000+casecount);
        !           267:                                else fprintf(fout,"case %d:\n",casecount);
        !           268:                                sharpline();
        !           269:                                if(cpyact()){
        !           270:                                        if(ratfor)fprintf(fout,"goto 30997\n");
        !           271:                                        else fprintf(fout,"break;\n");
        !           272:                                        }
        !           273:                                while((c=gch()) && c != '\n');
        !           274:                                if(peek == ' ' || peek == '\t' || sectbegin == TRUE){
        !           275:                                        warning("Executable statements should occur right after %%");
        !           276:                                        continue;
        !           277:                                        }
        !           278:                                x = NEWE;
        !           279:                                break;
        !           280:                        case '%':
        !           281:                                if(prev != '\n') goto character;
        !           282:                                if(peek == '{'){        /* included code */
        !           283:                                        sharpline();
        !           284:                                        getl(buf);
        !           285:                                        while(!eof && getl(buf) && scomp("%}",buf) != 0)
        !           286:                                                fprintf(fout,"%s\n",buf);
        !           287:                                        continue;
        !           288:                                        }
        !           289:                                if(peek == '%'){
        !           290:                                        c = gch();
        !           291:                                        c = gch();
        !           292:                                        x = DELIM;
        !           293:                                        break;
        !           294:                                        }
        !           295:                                goto character;
        !           296:                        case '|':
        !           297:                                if(peek == ' ' || peek == '\t' || peek == '\n'){
        !           298:                                        if(ratfor)fprintf(fout,"%d\n",30000+casecount++);
        !           299:                                        else fprintf(fout,"case %d:\n",casecount++);
        !           300:                                        continue;
        !           301:                                        }
        !           302:                                x = '|';
        !           303:                                break;
        !           304:                        case '$':
        !           305:                                if(peek == '\n' || peek == ' ' || peek == '\t' || peek == '|' || peek == '/'){
        !           306:                                        x = c;
        !           307:                                        break;
        !           308:                                        }
        !           309:                                goto character;
        !           310:                        case '^':
        !           311:                                if(prev != '\n' && scon != TRUE) goto character;        /* valid only at line begin */
        !           312:                                x = c;
        !           313:                                break;
        !           314:                        case '?':
        !           315:                        case '+':
        !           316:                        case '.':
        !           317:                        case '*':
        !           318:                        case '(':
        !           319:                        case ')':
        !           320:                        case ',':
        !           321:                        case '/':
        !           322:                                x = c;
        !           323:                                break;
        !           324:                        case '}':
        !           325:                                iter = FALSE;
        !           326:                                x = c;
        !           327:                                break;
        !           328:                        case '{':       /* either iteration or definition */
        !           329:                                if(digit(c=gch())){     /* iteration */
        !           330:                                        iter = TRUE;
        !           331:                                ieval:
        !           332:                                        i = 0;
        !           333:                                        while(digit(c)){
        !           334:                                                token[i++] = c;
        !           335:                                                c = gch();
        !           336:                                                }
        !           337:                                        token[i] = 0;
        !           338:                                        yylval.i = siconv(token);
        !           339:                                        munput('c',c);
        !           340:                                        x = ITER;
        !           341:                                        break;
        !           342:                                        }
        !           343:                                else {          /* definition */
        !           344:                                        i = 0;
        !           345:                                        while(c && c!='}'){
        !           346:                                                token[i++] = c;
        !           347:                                                c = gch();
        !           348:                                                }
        !           349:                                        token[i] = 0;
        !           350:                                        i = lookup(token,def);
        !           351:                                        if(i < 0)
        !           352:                                                warning("Definition %s not found",token);
        !           353:                                        else
        !           354:                                                munput('s',subs[i]);
        !           355:                                        continue;
        !           356:                                        }
        !           357:                        case '<':               /* start condition ? */
        !           358:                                if(prev != '\n')                /* not at line begin, not start */
        !           359:                                        goto character;
        !           360:                                t = slptr;
        !           361:                                do {
        !           362:                                        i = 0;
        !           363:                                        c = gch();
        !           364:                                        while(c != ',' && c && c != '>'){
        !           365:                                                token[i++] = c;
        !           366:                                                c = gch();
        !           367:                                                }
        !           368:                                        token[i] = 0;
        !           369:                                        if(i == 0)
        !           370:                                                goto character;
        !           371:                                        i = lookup(token,sname);
        !           372:                                        if(i < 0) {
        !           373:                                                warning("Undefined start condition %s",token);
        !           374:                                                continue;
        !           375:                                                }
        !           376:                                        *slptr++ = i+1;
        !           377:                                        } while(c && c != '>');
        !           378:                                *slptr++ = 0;
        !           379:                                /* check if previous value re-usable */
        !           380:                                for (xp=slist; xp<t; )
        !           381:                                        {
        !           382:                                        if (strcmp(xp, t)==0)
        !           383:                                                break;
        !           384:                                        while (*xp++);
        !           385:                                        }
        !           386:                                if (xp<t)
        !           387:                                        {
        !           388:                                        /* re-use previous pointer to string */
        !           389:                                        slptr=t;
        !           390:                                        t=xp;
        !           391:                                        }
        !           392:                                if(slptr > slist+STARTSIZE)             /* note not packed ! */
        !           393:                                        error("Too many start conditions used");
        !           394:                                yylval.cp = t;
        !           395:                                x = SCON;
        !           396:                                break;
        !           397:                        case '"':
        !           398:                                i = 0;
        !           399:                                while((c=gch()) && c != '"' && c != '\n'){
        !           400:                                        if(c == '\\') c = usescape(c=gch());
        !           401:                                        token[i++] = c;
        !           402:                                        if(i > TOKENSIZE){
        !           403:                                                warning("String too long");
        !           404:                                                i = TOKENSIZE-1;
        !           405:                                                break;
        !           406:                                                }
        !           407:                                        }
        !           408:                                if(c == '\n') {
        !           409:                                        yyline--;
        !           410:                                        warning("Non-terminated string");
        !           411:                                        yyline++;
        !           412:                                        }
        !           413:                                token[i] = 0;
        !           414:                                if(i == 0)x = NULLS;
        !           415:                                else if(i == 1){
        !           416:                                        yylval.i = token[0];
        !           417:                                        x = CHAR;
        !           418:                                        }
        !           419:                                else {
        !           420:                                        yylval.cp = token;
        !           421:                                        x = STR;
        !           422:                                        }
        !           423:                                break;
        !           424:                        case '[':
        !           425:                                for(i=1;i<NCH;i++) symbol[i] = 0;
        !           426:                                x = CCL;
        !           427:                                if((c = gch()) == '^'){
        !           428:                                        x = NCCL;
        !           429:                                        c = gch();
        !           430:                                        }
        !           431:                                while(c != ']' && c){
        !           432:                                        if(c == '\\') c = usescape(c=gch());
        !           433:                                        symbol[c] = 1;
        !           434:                                        j = c;
        !           435:                                        if((c=gch()) == '-' && peek != ']'){            /* range specified */
        !           436:                                                c = gch();
        !           437:                                                if(c == '\\') c = usescape(c=gch());
        !           438:                                                k = c;
        !           439:                                                if(j > k) {
        !           440:                                                        n = j;
        !           441:                                                        j = k;
        !           442:                                                        k = n;
        !           443:                                                        }
        !           444:                                                if(!(('A' <= j && k <= 'Z') ||
        !           445:                                                     ('a' <= j && k <= 'z') ||
        !           446:                                                     ('0' <= j && k <= '9')))
        !           447:                                                        warning("Non-portable Character Class");
        !           448:                                                for(n=j+1;n<=k;n++)
        !           449:                                                        symbol[n] = 1;          /* implementation dependent */
        !           450:                                                c = gch();
        !           451:                                                }
        !           452:                                        }
        !           453:                                /* try to pack ccl's */
        !           454:                                i = 0;
        !           455:                                for(j=0;j<NCH;j++)
        !           456:                                        if(symbol[j])token[i++] = j;
        !           457:                                token[i] = 0;
        !           458:                                p = ccptr;
        !           459:                                if(optim){
        !           460:                                        p = ccl;
        !           461:                                        while(p <ccptr && scomp(token,p) != 0)p++;
        !           462:                                        }
        !           463:                                if(p < ccptr)   /* found it */
        !           464:                                        yylval.cp = p;
        !           465:                                else {
        !           466:                                        yylval.cp = ccptr;
        !           467:                                        scopy(token,ccptr);
        !           468:                                        ccptr += slength(token) + 1;
        !           469:                                        if(ccptr >= ccl+CCLSIZE)
        !           470:                                                error("Too many large character classes");
        !           471:                                        }
        !           472:                                cclinter(x==CCL);
        !           473:                                break;
        !           474:                        case '\\':
        !           475:                                c = usescape(c=gch());
        !           476:                        default:
        !           477:                        character:
        !           478:                                if(iter){       /* second part of an iteration */
        !           479:                                        iter = FALSE;
        !           480:                                        if('0' <= c && c <= '9')
        !           481:                                                goto ieval;
        !           482:                                        }
        !           483:                                if(alpha(peek)){
        !           484:                                        i = 0;
        !           485:                                        yylval.cp = token;
        !           486:                                        token[i++] = c;
        !           487:                                        while(alpha(peek))
        !           488:                                                token[i++] = gch();
        !           489:                                        if(peek == '?' || peek == '*' || peek == '+')
        !           490:                                                munput('c',token[--i]);
        !           491:                                        token[i] = 0;
        !           492:                                        if(i == 1){
        !           493:                                                yylval.i = token[0];
        !           494:                                                x = CHAR;
        !           495:                                                }
        !           496:                                        else x = STR;
        !           497:                                        }
        !           498:                                else {
        !           499:                                        yylval.i = c;
        !           500:                                        x = CHAR;
        !           501:                                        }
        !           502:                                }
        !           503:                        scon = FALSE;
        !           504:                        if(x == SCON)scon = TRUE;
        !           505:                        sectbegin = FALSE;
        !           506:                        return(freturn(x));
        !           507:                        }
        !           508:                }
        !           509:        /* section three */
        !           510:        ptail();
        !           511: # ifdef DEBUG
        !           512:        if(debug)
        !           513:                fprintf(fout,"\n/*this comes from section three - debug */\n");
        !           514: # endif
        !           515:        sharpline();
        !           516:        while(getl(buf) && !eof)
        !           517:                fprintf(fout,"%s\n",buf);
        !           518:        return(freturn(0));
        !           519:        }
        !           520: /* end of yylex */
        !           521: # ifdef DEBUG
        !           522: freturn(i)
        !           523:   int i; {
        !           524:        if(yydebug) {
        !           525:                printf("now return ");
        !           526:                if(i < NCH) allprint(i);
        !           527:                else printf("%d",i);
        !           528:                printf("   yylval = ");
        !           529:                switch(i){
        !           530:                        case STR: case CCL: case NCCL:
        !           531:                                strpt(yylval.cp);
        !           532:                                break;
        !           533:                        case CHAR:
        !           534:                                allprint(yylval.i);
        !           535:                                break;
        !           536:                        default:
        !           537:                                printf("%d",yylval.i);
        !           538:                                break;
        !           539:                        }
        !           540:                putchar('\n');
        !           541:                }
        !           542:        return(i);
        !           543:        }
        !           544: # endif
        !           545: short yyexca[] ={
        !           546: -1, 0,
        !           547:        260, 8,
        !           548:        261, 8,
        !           549:        -2, 0,
        !           550: -1, 1,
        !           551:        0, -1,
        !           552:        -2, 0,
        !           553: -1, 5,
        !           554:        0, 6,
        !           555:        -2, 0,
        !           556: -1, 8,
        !           557:        0, 6,
        !           558:        -2, 0,
        !           559:        };
        !           560: # define YYNPROD 33
        !           561: # define YYLAST 291
        !           562: short yyact[]={
        !           563: 
        !           564:   34,  45,  35,  23,  21,  43,  27,  28,   4,  34,
        !           565:   16,  32,  41,  21,  46,  27,  28,  10,  34,  16,
        !           566:   32,   8,  21,   9,  27,  28,  25,  29,  16,   6,
        !           567:    7,   3,  24,  34,  27,  28,  29,  21,  11,  27,
        !           568:   28,   2,   5,  16,   1,  29,  21,   0,  27,  28,
        !           569:    0,   0,  16,   0,   0,  29,  21,   0,  20,   0,
        !           570:   29,   0,  16,   0,   0,  21,   0,  20,   0,  29,
        !           571:    0,  16,   0,   0,  31,   0,  20,   0,   0,   0,
        !           572:   12,   0,   0,  12,   0,   0,   0,   0,  30,   0,
        !           573:    0,  20,   0,  42,  36,  37,  38,  30,   0,   0,
        !           574:    0,   0,   0,   0,   0,  39,  30,  40,   0,   0,
        !           575:   20,   0,   0,   0,   0,   0,   0,   0,   0,  20,
        !           576:    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
        !           577:    0,   0,   0,   0,   0,   0,   0,   0,   0,  44,
        !           578:    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
        !           579:    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
        !           580:    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
        !           581:    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
        !           582:    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
        !           583:    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
        !           584:    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
        !           585:    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
        !           586:    0,  14,  17,  18,  15,   0,  19,  33,   0,  22,
        !           587:   14,  17,  18,  15,   0,  19,  33,  26,  22,  14,
        !           588:   17,  18,  15,   0,   0,  33,   0,  22,   0,   0,
        !           589:    0,   0,   0,   0,  14,  17,  18,  15,   0,   0,
        !           590:   33,   0,  22,  14,  17,  18,  15,   0,   0,  33,
        !           591:    0,  22,  13,  14,  17,  18,  15,   7,  19,   0,
        !           592:    0,  22,  14,  17,  18,  15,   0,  19,   0,   0,
        !           593:   22 };
        !           594: short yypact[]={
        !           595: 
        !           596: -248,-1000,-1000,-231,-1000,  16,-257,-1000,  16,-1000,
        !           597: -1000,-1000, -27,-262,-1000,-1000,-1000,-1000,-1000,  25,
        !           598:   25,  25,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
        !           599:   25,  -8,  25, -32,-1000,-1000, -18,   6, -36,  -3,
        !           600:  -18,-124,-1000,-1000,-111,-1000,-1000 };
        !           601: short yypgo[]={
        !           602: 
        !           603:    0,  44,  41,  31,  38,  21,  23,  17,  74 };
        !           604: short yyr1[]={
        !           605: 
        !           606:    0,   1,   2,   2,   2,   6,   6,   3,   3,   4,
        !           607:    5,   5,   7,   7,   8,   8,   8,   8,   8,   8,
        !           608:    8,   8,   8,   8,   8,   8,   8,   8,   8,   8,
        !           609:    8,   8,   8 };
        !           610: short yyr2[]={
        !           611: 
        !           612:    0,   1,   4,   3,   1,   1,   0,   3,   0,   1,
        !           613:    2,   1,   2,   2,   1,   1,   1,   1,   1,   2,
        !           614:    2,   2,   3,   2,   3,   5,   3,   4,   2,   2,
        !           615:    2,   3,   1 };
        !           616: short yychk[]={
        !           617: 
        !           618: -1000,  -1,  -2,  -3, 256,  -4, 260, 261,  -5,  -6,
        !           619:   -7,  -4,  -8, 256, 257, 260,  46, 258, 259, 262,
        !           620:   94,  40, 265, 260,  -6,  -7, 264,  42,  43,  63,
        !           621:  124,  -8,  47, 263,  36, 264,  -8,  -8,  -8,  -8,
        !           622:   -8,  44, 125,  41, 263, 125, 125 };
        !           623: short yydef[]={
        !           624: 
        !           625:   -2,  -2,   1,   0,   4,  -2,   0,   9,  -2,   3,
        !           626:   11,   5,   0,   0,  14,  15,  16,  17,  18,   0,
        !           627:    0,   0,  32,   7,   2,  10,  12,  19,  20,  21,
        !           628:    0,  23,   0,   0,  30,  13,  28,  29,   0,  22,
        !           629:   24,   0,  26,  31,   0,  27,  25 };
        !           630: # ifdef YYDEBUG
        !           631: # include "y.debug"
        !           632: # endif
        !           633: 
        !           634: # define YYFLAG -1000
        !           635: # define YYERROR goto yyerrlab
        !           636: # define YYACCEPT return(0)
        !           637: # define YYABORT return(1)
        !           638: 
        !           639: /*     parser for yacc output  */
        !           640: 
        !           641: #ifdef YYDEBUG
        !           642: int yydebug = 0; /* 1 for debugging */
        !           643: #endif
        !           644: YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
        !           645: int yychar = -1; /* current input token number */
        !           646: int yynerrs = 0;  /* number of errors */
        !           647: short yyerrflag = 0;  /* error recovery flag */
        !           648: 
        !           649: yyparse()
        !           650: {      short yys[YYMAXDEPTH];
        !           651:        int yyj, yym;
        !           652:        register YYSTYPE *yypvt;
        !           653:        register int yystate, yyn;
        !           654:        register short *yyps;
        !           655:        register YYSTYPE *yypv;
        !           656:        register short *yyxi;
        !           657: 
        !           658:        yystate = 0;
        !           659:        yychar = -1;
        !           660:        yynerrs = 0;
        !           661:        yyerrflag = 0;
        !           662:        yyps= &yys[-1];
        !           663:        yypv= &yyv[-1];
        !           664: 
        !           665: yystack:    /* put a state and value onto the stack */
        !           666: #ifdef YYDEBUG
        !           667:        if(yydebug >= 3)
        !           668:                if(yychar < 0 || yytoknames[yychar] == 0)
        !           669:                        printf("char %d in %s", yychar, yystates[yystate]);
        !           670:                else
        !           671:                        printf("%s in %s", yytoknames[yychar], yystates[yystate]);
        !           672: #endif
        !           673:        if( ++yyps >= &yys[YYMAXDEPTH] ) { 
        !           674:                yyerror( "yacc stack overflow" ); 
        !           675:                return(1)        !           676:        }
        !           677:        *yyps = yystate;
        !           678:        ++yypv;
        !           679:        *yypv = yyval;
        !           680: yynewstate:
        !           681:        yyn = yypact[yystate];
        !           682:        if(yyn <= YYFLAG) goto yydefault; /* simple state */
        !           683:        if(yychar<0) {
        !           684:                yychar = yylex();
        !           685: #ifdef YYDEBUG
        !           686:                if(yydebug >= 2) {
        !           687:                        if(yychar <= 0)
        !           688:                                printf("lex EOF\n");
        !           689:                        else if(yytoknames[yychar])
        !           690:                                printf("lex %s\n", yytoknames[yychar]);
        !           691:                        else
        !           692:                                printf("lex (%c)\n", yychar);
        !           693:                }
        !           694: #endif
        !           695:                if(yychar < 0)
        !           696:                        yychar = 0;
        !           697:        }
        !           698:        if((yyn += yychar) < 0 || yyn >= YYLAST)
        !           699:                goto yydefault;
        !           700:        if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
        !           701:                yychar = -1;
        !           702:                yyval = yylval;
        !           703:                yystate = yyn;
        !           704:                if( yyerrflag > 0 ) --yyerrflag;
        !           705:                goto yystack;
        !           706:        }
        !           707: yydefault:
        !           708:        /* default state action */
        !           709:        if( (yyn=yydef[yystate]) == -2 ) {
        !           710:                if(yychar < 0) {
        !           711:                        yychar = yylex();
        !           712: #ifdef YYDEBUG
        !           713:                        if(yydebug >= 2)
        !           714:                                if(yychar < 0)
        !           715:                                        printf("lex EOF\n");
        !           716:                                else
        !           717:                                        printf("lex %s\n", yytoknames[yychar]);
        !           718: #endif
        !           719:                        if(yychar < 0)
        !           720:                                yychar = 0;
        !           721:                }
        !           722:                /* look through exception table */
        !           723:                for(yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate);
        !           724:                        yyxi += 2 ) ; /* VOID */
        !           725:                while( *(yyxi+=2) >= 0 ){
        !           726:                        if( *yyxi == yychar ) break;
        !           727:                }
        !           728:                if( (yyn = yyxi[1]) < 0 ) return(0);   /* accept */
        !           729:        }
        !           730:        if( yyn == 0 ){ /* error */
        !           731:                /* error ... attempt to resume parsing */
        !           732:                switch( yyerrflag ){
        !           733:                case 0:   /* brand new error */
        !           734: #ifdef YYDEBUG
        !           735:                        yyerror("syntax error\n%s", yystates[yystate]);
        !           736:                        if(yytoknames[yychar])
        !           737:                                yyerror("saw %s\n", yytoknames[yychar]);
        !           738:                        else if(yychar >= ' ' && yychar < '\177')
        !           739:                                yyerror("saw `%c'\n", yychar);
        !           740:                        else if(yychar == 0)
        !           741:                                yyerror("saw EOF\n");
        !           742:                        else
        !           743:                                yyerror("saw char 0%o\n", yychar);
        !           744: #else
        !           745:                        yyerror( "syntax error" );
        !           746: #endif
        !           747: yyerrlab:
        !           748:                        ++yynerrs;
        !           749:                case 1:
        !           750:                case 2: /* incompletely recovered error ... try again */
        !           751:                        yyerrflag = 3;
        !           752:                        /* find a state where "error" is a legal shift action */
        !           753:                        while ( yyps >= yys ) {
        !           754:                                yyn = yypact[*yyps] + YYERRCODE;
        !           755:                                if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
        !           756:                                        yystate = yyact[yyn];  /* simulate a shift of "error" */
        !           757:                                        goto yystack;
        !           758:                                }
        !           759:                                yyn = yypact[*yyps];
        !           760:                                /* the current yyps has no shift onn "error", pop stack */
        !           761: #ifdef YYDEBUG
        !           762:                                if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
        !           763: #endif
        !           764:                                --yyps;
        !           765:                                --yypv;
        !           766:                        }
        !           767:                        /* there is no state on the stack with an error shift ... abort */
        !           768: yyabort:
        !           769:                        return(1);
        !           770:                case 3:  /* no shift yet; clobber input char */
        !           771: #ifdef YYDEBUG
        !           772:                        if( yydebug ) {
        !           773:                                printf("error recovery discards ");
        !           774:                                if(yytoknames[yychar])
        !           775:                                        printf("%s\n", yytoknames[yychar]);
        !           776:                                else if(yychar >= ' ' && yychar < '\177')
        !           777:                                        printf("`%c'\n", yychar);
        !           778:                                else if(yychar == 0)
        !           779:                                        printf("EOF\n");
        !           780:                                else
        !           781:                                        printf("char 0%o\n", yychar);
        !           782:                        }
        !           783: #endif
        !           784:                        if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
        !           785:                        yychar = -1;
        !           786:                        goto yynewstate;   /* try again in the same state */
        !           787:                }
        !           788:        }
        !           789:        /* reduction by production yyn */
        !           790: #ifdef YYDEBUG
        !           791:        if(yydebug) {   char *s;
        !           792:                printf("reduce %d in:\n\t", yyn);
        !           793:                for(s = yystates[yystate]; *s; s++) {
        !           794:                        putchar(*s);
        !           795:                        if(*s == '\n' && *(s+1))
        !           796:                                putchar('\t');
        !           797:                }
        !           798:        }
        !           799: #endif
        !           800:        yyps -= yyr2[yyn];
        !           801:        yypvt = yypv;
        !           802:        yypv -= yyr2[yyn];
        !           803:        yyval = yypv[1];
        !           804:        yym=yyn;
        !           805:        /* consult goto table to find next state */
        !           806:        yyn = yyr1[yyn];
        !           807:        yyj = yypgo[yyn] + *yyps + 1;
        !           808:        if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
        !           809:        switch(yym){
        !           810:                
        !           811: case 1:
        !           812: # line 27 "parser.y"
        !           813: {      
        !           814: # ifdef DEBUG
        !           815:                if(debug) sect2dump();
        !           816: # endif
        !           817:        } break;
        !           818: case 3:
        !           819: # line 35 "parser.y"
        !           820: {
        !           821:                if(!funcflag)phead2();
        !           822:                funcflag = TRUE;
        !           823:        } break;
        !           824: case 4:
        !           825: # line 40 "parser.y"
        !           826: {
        !           827: # ifdef DEBUG
        !           828:                if(debug) {
        !           829:                        sect1dump();
        !           830:                        sect2dump();
        !           831:                        }
        !           832: # endif
        !           833:                } break;
        !           834: case 7:
        !           835: # line 51 "parser.y"
        !           836: {      scopy(yypvt[-1],dp);
        !           837:                def[dptr] = dp;
        !           838:                dp += slength(yypvt[-1]) + 1;
        !           839:                scopy(yypvt[-0],dp);
        !           840:                subs[dptr++] = dp;
        !           841:                if(dptr >= DEFSIZE)
        !           842:                        error("Too many definitions");
        !           843:                dp += slength(yypvt[-0]) + 1;
        !           844:                if(dp >= dchar+DEFCHAR)
        !           845:                        error("Definitions too long");
        !           846:                subs[dptr]=def[dptr]=0; /* for lookup - require ending null */
        !           847:        } break;
        !           848: case 9:
        !           849: # line 66 "parser.y"
        !           850: {
        !           851: # ifdef DEBUG
        !           852:                if(sect == DEFSECTION && debug) sect1dump();
        !           853: # endif
        !           854:                sect++;
        !           855:                } break;
        !           856: case 10:
        !           857: # line 74 "parser.y"
        !           858: {      yyval.i = mn2(RNEWE,yypvt[-1].i,yypvt[-0].i);
        !           859:                } break;
        !           860: case 11:
        !           861: # line 77 "parser.y"
        !           862: {      yyval.i = yypvt[-0].i;} break;
        !           863: case 12:
        !           864: # line 80 "parser.y"
        !           865: {
        !           866:                if(divflg == TRUE)
        !           867:                        i = mn1(S1FINAL,casecount);
        !           868:                else i = mn1(FINAL,casecount);
        !           869:                yyval.i = mn2(RCAT,yypvt[-1].i,i);
        !           870:                divflg = FALSE;
        !           871:                casecount++;
        !           872:                } break;
        !           873: case 13:
        !           874: # line 89 "parser.y"
        !           875: {
        !           876: # ifdef DEBUG
        !           877:                if(debug) sect2dump();
        !           878: # endif
        !           879:                } break;
        !           880: case 14:
        !           881: # line 95 "parser.y"
        !           882: {      yyval.i = mn0(yypvt[-0].i); } break;
        !           883: case 15:
        !           884: # line 97 "parser.y"
        !           885: {
        !           886:                p = yypvt[-0].cp;
        !           887:                i = mn0(*p++);
        !           888:                while(*p)
        !           889:                        i = mn2(RSTR,i,*p++);
        !           890:                yyval.i = i;
        !           891:                } break;
        !           892: case 16:
        !           893: # line 105 "parser.y"
        !           894: {      symbol['\n'] = 0;
        !           895:                if(psave == FALSE){
        !           896:                        p = ccptr;
        !           897:                        psave = ccptr;
        !           898:                        for(i=1;i<'\n';i++){
        !           899:                                symbol[i] = 1;
        !           900:                                *ccptr++ = i;
        !           901:                                }
        !           902:                        for(i='\n'+1;i<NCH;i++){
        !           903:                                symbol[i] = 1;
        !           904:                                *ccptr++ = i;
        !           905:                                }
        !           906:                        *ccptr++ = 0;
        !           907:                        if(ccptr > ccl+CCLSIZE)
        !           908:                                error("Too many large character classes");
        !           909:                        }
        !           910:                else
        !           911:                        p = psave;
        !           912:                yyval.i = mn1(RCCL,p);
        !           913:                cclinter(1);
        !           914:                } break;
        !           915: case 17:
        !           916: # line 127 "parser.y"
        !           917: {      yyval.i = mn1(RCCL,yypvt[-0].i); } break;
        !           918: case 18:
        !           919: # line 129 "parser.y"
        !           920: {      yyval.i = mn1(RNCCL,yypvt[-0].i); } break;
        !           921: case 19:
        !           922: # line 131 "parser.y"
        !           923: {      yyval.i = mn1(STAR,yypvt[-1].i); } break;
        !           924: case 20:
        !           925: # line 133 "parser.y"
        !           926: {      yyval.i = mn1(PLUS,yypvt[-1].i); } break;
        !           927: case 21:
        !           928: # line 135 "parser.y"
        !           929: {      yyval.i = mn1(QUEST,yypvt[-1].i); } break;
        !           930: case 22:
        !           931: # line 137 "parser.y"
        !           932: {      yyval.i = mn2(BAR,yypvt[-2].i,yypvt[-0].i); } break;
        !           933: case 23:
        !           934: # line 139 "parser.y"
        !           935: {      yyval.i = mn2(RCAT,yypvt[-1].i,yypvt[-0].i); } break;
        !           936: case 24:
        !           937: # line 141 "parser.y"
        !           938: {      if(!divflg){
        !           939:                        j = mn1(S2FINAL,-casecount);
        !           940:                        i = mn2(RCAT,yypvt[-2].i,j);
        !           941:                        yyval.i = mn2(DIV,i,yypvt[-0].i);
        !           942:                        }
        !           943:                else {
        !           944:                        yyval.i = mn2(RCAT,yypvt[-2].i,yypvt[-0].i);
        !           945:                        warning("Extra slash removed");
        !           946:                        }
        !           947:                divflg = TRUE;
        !           948:                } break;
        !           949: case 25:
        !           950: # line 153 "parser.y"
        !           951: {      if(yypvt[-3].i > yypvt[-1].i){
        !           952:                        i = yypvt[-3].i;
        !           953:                        yypvt[-3].i = yypvt[-1].i;
        !           954:                        yypvt[-1].i = i;
        !           955:                        }
        !           956:                if(yypvt[-1].i <= 0)
        !           957:                        warning("Iteration range must be positive");
        !           958:                else {
        !           959:                        j = yypvt[-4].i;
        !           960:                        for(k = 2; k<=yypvt[-3].i;k++)
        !           961:                                j = mn2(RCAT,j,dupl(yypvt[-4].i));
        !           962:                        for(i = yypvt[-3].i+1; i<=yypvt[-1].i; i++){
        !           963:                                g = dupl(yypvt[-4].i);
        !           964:                                for(k=2;k<=i;k++)
        !           965:                                        g = mn2(RCAT,g,dupl(yypvt[-4].i));
        !           966:                                j = mn2(BAR,j,g);
        !           967:                                }
        !           968:                        yyval.i = j;
        !           969:                        }
        !           970:        } break;
        !           971: case 26:
        !           972: # line 174 "parser.y"
        !           973: {
        !           974:                if(yypvt[-1].i < 0)warning("Can't have negative iteration");
        !           975:                else if(yypvt[-1].i == 0) yyval.i = mn0(RNULLS);
        !           976:                else {
        !           977:                        j = yypvt[-2].i;
        !           978:                        for(k=2;k<=yypvt[-1].i;k++)
        !           979:                                j = mn2(RCAT,j,dupl(yypvt[-2].i));
        !           980:                        yyval.i = j;
        !           981:                        }
        !           982:                } break;
        !           983: case 27:
        !           984: # line 185 "parser.y"
        !           985: {
        !           986:                                /* from n to infinity */
        !           987:                if(yypvt[-2].i < 0)warning("Can't have negative iteration");
        !           988:                else if(yypvt[-2].i == 0) yyval.i = mn1(STAR,yypvt[-3].i);
        !           989:                else if(yypvt[-2].i == 1)yyval.i = mn1(PLUS,yypvt[-3].i);
        !           990:                else {          /* >= 2 iterations minimum */
        !           991:                        j = yypvt[-3].i;
        !           992:                        for(k=2;k<yypvt[-2].i;k++)
        !           993:                                j = mn2(RCAT,j,dupl(yypvt[-3].i));
        !           994:                        k = mn1(PLUS,dupl(yypvt[-3].i));
        !           995:                        yyval.i = mn2(RCAT,j,k);
        !           996:                        }
        !           997:                } break;
        !           998: case 28:
        !           999: # line 199 "parser.y"
        !          1000: {      yyval.i = mn2(RSCON,yypvt[-0].i,yypvt[-1].i); } break;
        !          1001: case 29:
        !          1002: # line 201 "parser.y"
        !          1003: {      yyval.i = mn1(CARAT,yypvt[-0].i); } break;
        !          1004: case 30:
        !          1005: # line 203 "parser.y"
        !          1006: {      i = mn0('\n');
        !          1007:                if(!divflg){
        !          1008:                        j = mn1(S2FINAL,-casecount);
        !          1009:                        k = mn2(RCAT,yypvt[-1].i,j);
        !          1010:                        yyval.i = mn2(DIV,k,i);
        !          1011:                        }
        !          1012:                else yyval.i = mn2(RCAT,yypvt[-1].i,i);
        !          1013:                divflg = TRUE;
        !          1014:                } break;
        !          1015: case 31:
        !          1016: # line 213 "parser.y"
        !          1017: {      yyval.i = yypvt[-1].i; } break;
        !          1018: case 32:
        !          1019: # line 215 "parser.y"
        !          1020: {      yyval.i = mn0(RNULLS); } break;
        !          1021:        }
        !          1022:        goto yystack;  /* stack new state and value */
        !          1023: }

unix.superglobalmegacorp.com

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