Annotation of 43BSDReno/contrib/isode-beta/others/quipu/uips/sd/y.tab.c, revision 1.1.1.1

1.1       root        1: 
                      2: # line 2 "conf_read.y"
                      3: #ifndef lint
                      4: static char *rcsid = "$Header: /f/osi/others/quipu/uips/sd/RCS/y.tab.c,v 7.0 90/06/12 13:14:08 mrose Exp $";
                      5: #endif
                      6: 
                      7: /*
                      8:  * $Header: /f/osi/others/quipu/uips/sd/RCS/y.tab.c,v 7.0 90/06/12 13:14:08 mrose Exp $
                      9:  */
                     10: 
                     11: /*
                     12:  * $Log:       y.tab.c,v $
                     13:  * Revision 7.0  90/06/12  13:14:08  mrose
                     14:  * *** empty log message ***
                     15:  * 
                     16:  * Revision 1.6  90/04/26  10:36:54  emsrdsm
                     17:  * *** empty log message ***
                     18:  * 
                     19:  * Revision 1.5  90/04/25  15:08:06  emsrdsm
                     20:  * i) lint'ed
                     21:  * 
                     22:  * Revision 1.4  90/04/20  17:58:22  emsrdsm
                     23:  * i) no more freeing
                     24:  * 
                     25:  * Revision 1.3  90/04/18  18:28:39  emsrdsm
                     26:  * fixed i) does not move to leaves
                     27:  *       ii) added default mechanism described using "typeDefaults" file.
                     28:  *      iii) added 'sorting' to attribute display
                     29:  * 
                     30:  * Revision 1.2  90/03/15  16:34:20  emsrdsm
                     31:  * *** empty log message ***
                     32:  * 
                     33:  * Revision 1.1  90/03/09  17:58:22  emsrdsm
                     34:  * Initial revision
                     35:  * 
                     36:  */
                     37: 
                     38: #include <stdio.h>
                     39: #include <ctype.h>
                     40: #include <string.h>
                     41: 
                     42: #include "filt.h"
                     43: #include "symtab.h"
                     44: 
                     45: extern make_type();
                     46: extern filt_struct *make_item_filter();
                     47: extern filt_struct *link_filters();
                     48: extern filt_struct *make_parent_filter();
                     49: extern put_symbol_value();
                     50: 
                     51: extern FILE *file;
                     52: extern int curr_filt;
                     53: extern char **file_names;
                     54: extern table_entry symtab;
                     55: 
                     56: # line 54 "conf_read.y"
                     57: typedef union  {
                     58:        filt_struct *filt;
                     59:        char strval[255];
                     60:        int symbol;
                     61: } YYSTYPE;
                     62: # define NUMBER 257
                     63: # define NAME 258
                     64: # define DEFAULT 259
                     65: # define STRING 260
                     66: # define OID 261
                     67: # define AND 262
                     68: # define OR 263
                     69: # define NOT 264
                     70: # define APPROX 265
                     71: # define EQUAL 266
                     72: # define ITEM 267
                     73: # define SUBSTRING 268
                     74: #define yyclearin yychar = -1
                     75: #define yyerrok yyerrflag = 0
                     76: extern int yychar;
                     77: extern short yyerrflag;
                     78: #ifndef YYMAXDEPTH
                     79: #define YYMAXDEPTH 150
                     80: #endif
                     81: YYSTYPE yylval, yyval;
                     82: # define YYERRCODE 256
                     83: 
                     84: # line 105 "conf_read.y"
                     85: 
                     86: 
                     87: yylex()
                     88: {
                     89:        int c, count = 0;
                     90:        char lexeme[255];
                     91: 
                     92:        while(iswspace(c = getc(file)))
                     93:                if (c == EOF) return(0);
                     94: 
                     95:         lexeme[count++] = c;
                     96:        
                     97:        switch(c) {
                     98:              case '#':
                     99:                while (getc(file) != '\n');
                    100:                return(yylex());
                    101:               case '"':
                    102:                count = 0;
                    103:                while ((c = getc(file)) != '"')
                    104:                        lexeme[count++] = c;
                    105:                lexeme[count] = '\0';
                    106:                (void) strcpy(yylval.strval, lexeme);
                    107:                return STRING;
                    108:              case '$':
                    109:                while (!iswspace((c = getc(file))) && !issymbol(c))
                    110:                        lexeme[count++] = c;
                    111:                lexeme[count] = '\0';
                    112:                put_symbol_value(symtab, lexeme+1, (char *) 0);
                    113:                (void) strcpy(yylval.strval, lexeme);
                    114:                 return STRING;
                    115:              case '(':
                    116:                return (int) c;
                    117:              case ')':
                    118:                return (int) c;
                    119:              case ':':
                    120:                return (int) c;
                    121:              case '&':
                    122:                yylval.symbol = AND;
                    123:                return AND;
                    124:              case '|':
                    125:                yylval.symbol = OR;
                    126:                return OR;
                    127:              case '!':
                    128:                yylval.symbol = NOT;
                    129:                return NOT;
                    130:              case '*':
                    131:                lexeme[count] = '\0';
                    132:                (void) strcpy(yylval.strval, lexeme);
                    133:                return STRING;
                    134:              case '~':
                    135:                if((lexeme[count] = getc(file)) == '=') {
                    136:                        yylval.symbol = APPROX;
                    137:                        return APPROX;
                    138:                      }                 
                    139:                break;
                    140:              case '%':
                    141:                if((lexeme[count] = getc(file)) == '=') {
                    142:                         yylval.symbol = SUBSTRING;
                    143:                        return SUBSTRING;
                    144:                      }
                    145:                break;
                    146:              case '=':
                    147:                yylval.symbol = EQUAL;
                    148:                return EQUAL;
                    149:              }
                    150: 
                    151:        while(!iswspace(c = getc(file)) && c != '\0' && !issymbol(c))
                    152:                if (c != EOF)
                    153:                        lexeme[count++] = c;
                    154:                else
                    155:                        return(0);
                    156: 
                    157:        (void) fseek(file,(long) -1, 1);
                    158: 
                    159:        lexeme[count] = '\0';
                    160:        switch(*lexeme) {
                    161:              case 'd':
                    162:              case 'D':
                    163:                if(!strcmp(lexeme, "default") || !strcmp(lexeme, "DEFAULT"))
                    164:                        return DEFAULT;
                    165:                else {
                    166:                        (void) strcpy(yylval.strval, lexeme);
                    167:                        return STRING;
                    168:                }
                    169:              case 'n':
                    170:              case 'N':
                    171:                if(!strcmp(lexeme, "name") || !strcmp(lexeme, "NAME"))
                    172:                        return NAME;
                    173:                else {
                    174:                         (void) strcpy(yylval.strval, lexeme);
                    175:                        return STRING;
                    176:                }
                    177:              case '0':
                    178:              case '1':
                    179:              case '2':
                    180:              case '3':
                    181:              case '4':
                    182:              case '5':
                    183:              case '6':
                    184:              case '7':
                    185:              case '8':
                    186:              case '9':
                    187:                count = 0;
                    188:                while (isdigit(lexeme[count]) || lexeme[count] == '.') count++;
                    189:                if (lexeme[count] == '\0') {
                    190:                        (void) strcpy(yylval.strval, lexeme);
                    191:                        return OID;
                    192:                } else {
                    193:                        (void) strcpy(yylval.strval, lexeme);
                    194:                        return STRING;
                    195:                }
                    196:              default:
                    197:                (void) strcpy(yylval.strval, lexeme);
                    198:                return STRING;
                    199:        }
                    200: }
                    201: 
                    202: yyerror(err)
                    203: char *err;
                    204: {
                    205:   /* Sorry */
                    206:   (void) fprintf(stderr, "Parse error in 'filterTypes' dir: ");
                    207:   (void) fprintf(stderr, err);
                    208:   (void) fprintf(stderr, "\n");
                    209: }
                    210: 
                    211: int
                    212: issymbol(c)
                    213: char c;
                    214: {
                    215:        switch(c) {
                    216:              case '#':
                    217:                 return 1;
                    218:               case '"':
                    219:                 return 1;
                    220:              case '(':
                    221:                return 1;
                    222:              case ')':
                    223:                return 1;
                    224:              case ':':
                    225:                return 1;
                    226:              case '&':
                    227:                return 1;
                    228:              case '|':
                    229:                return 1;
                    230:              case '!':
                    231:                return 1;
                    232:              case '*':
                    233:                return 1;
                    234:              case '~':
                    235:                return 1;
                    236:              case '=':
                    237:                return 1;
                    238:              case '$':
                    239:                return 1;
                    240:              case '%':
                    241:                return 1;
                    242:        }
                    243:        return 0;
                    244: }
                    245: 
                    246: int
                    247: iswspace(c)
                    248: char c;
                    249: {
                    250:        switch(c) {
                    251:              case ' ':
                    252:                return 1;
                    253:              case '\n':
                    254:                return 1;
                    255:              case '\t':
                    256:                return 1;
                    257:        }
                    258:        return 0;
                    259: }
                    260: 
                    261: 
                    262: 
                    263: short yyexca[] ={
                    264: -1, 1,
                    265:        0, -1,
                    266:        -2, 0,
                    267:        };
                    268: # define YYNPROD 19
                    269: # define YYLAST 42
                    270: short yyact[]={
                    271: 
                    272:   18,  19,  23,  20,  11,  12,  13,  10,  14,   3,
                    273:    8,  27,  26,  22,   7,  24,  25,  -1,   2,   4,
                    274:   17,   9,   5,   6,   1,   0,  15,  16,   0,   0,
                    275:    0,   0,  21,   0,   0,   0,   0,   0,   0,   0,
                    276:    0,  28 };
                    277: short yypact[]={
                    278: 
                    279: -249,-1000, -26, -48,-1000,-1000,-1000,-257,-252, -26,
                    280:  -26,-265,-1000,-1000,-1000, -26, -28,-258,-1000,-1000,
                    281: -1000, -26,-1000, -29, -30, -26,-1000,-1000,-1000 };
                    282: short yypgo[]={
                    283: 
                    284:    0,  24,  16,  15,  23,  22,  21,  20,  18,  17 };
                    285: short yyr1[]={
                    286: 
                    287:    0,   1,   8,   9,   9,   4,   4,   4,   3,   3,
                    288:    3,   2,   2,   5,   7,   7,   7,   6,   6 };
                    289: short yyr2[]={
                    290: 
                    291:    0,   2,   3,   3,   0,   6,   4,   1,   2,   1,
                    292:    0,   1,   1,   5,   1,   1,   1,   1,   1 };
                    293: short yychk[]={
                    294: 
                    295: -1000,  -1,  -8, 258,  -2,  -5,  -4,  40,  58,  -6,
                    296:  264, 261, 262, 263, 260,  -2,  -2,  -7, 265, 266,
                    297:  268,  -2,  41, 260,  -3,  -2,  41,  41,  -3 };
                    298: short yydef[]={
                    299: 
                    300:    0,  -2,   0,   0,   1,   7,  12,   0,   0,   0,
                    301:    0,   0,  17,  18,   2,   0,   0,   0,  14,  15,
                    302:   16,  10,   6,   0,   0,   9,  13,   5,   8 };
                    303: #ifndef lint
                    304: static char yaccpar_sccsid[] = "@(#)yaccpar 1.3 86/10/08 SMI"; /* from UCB 4.1 83/02/11 */
                    305: #endif
                    306: 
                    307: #
                    308: # define YYFLAG -1000
                    309: # define YYERROR goto yyerrlab
                    310: # define YYACCEPT return(0)
                    311: # define YYABORT return(1)
                    312: 
                    313: /*     parser for yacc output  */
                    314: 
                    315: #ifdef YYDEBUG
                    316: int yydebug = 0; /* 1 for debugging */
                    317: #endif
                    318: YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
                    319: int yychar = -1; /* current input token number */
                    320: int yynerrs = 0;  /* number of errors */
                    321: short yyerrflag = 0;  /* error recovery flag */
                    322: 
                    323: yyparse() {
                    324: 
                    325:        short yys[YYMAXDEPTH];
                    326:        short yyj, yym;
                    327:        register YYSTYPE *yypvt;
                    328:        register short yystate, *yyps, yyn;
                    329:        register YYSTYPE *yypv;
                    330:        register short *yyxi;
                    331: 
                    332:        yystate = 0;
                    333:        yychar = -1;
                    334:        yynerrs = 0;
                    335:        yyerrflag = 0;
                    336:        yyps= &yys[-1];
                    337:        yypv= &yyv[-1];
                    338: 
                    339:  yystack:    /* put a state and value onto the stack */
                    340: 
                    341: #ifdef YYDEBUG
                    342:        if( yydebug  ) printf( "state %d, char 0%o\n", yystate, yychar );
                    343: #endif
                    344:                if( ++yyps>= &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
                    345:                *yyps = yystate;
                    346:                ++yypv;
                    347:                *yypv = yyval;
                    348: 
                    349:  yynewstate:
                    350: 
                    351:        yyn = yypact[yystate];
                    352: 
                    353:        if( yyn<= YYFLAG ) goto yydefault; /* simple state */
                    354: 
                    355:        if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
                    356:        if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;
                    357: 
                    358:        if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
                    359:                yychar = -1;
                    360:                yyval = yylval;
                    361:                yystate = yyn;
                    362:                if( yyerrflag > 0 ) --yyerrflag;
                    363:                goto yystack;
                    364:                }
                    365: 
                    366:  yydefault:
                    367:        /* default state action */
                    368: 
                    369:        if( (yyn=yydef[yystate]) == -2 ) {
                    370:                if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
                    371:                /* look through exception table */
                    372: 
                    373:                for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */
                    374: 
                    375:                while( *(yyxi+=2) >= 0 ){
                    376:                        if( *yyxi == yychar ) break;
                    377:                        }
                    378:                if( (yyn = yyxi[1]) < 0 ) return(0);   /* accept */
                    379:                }
                    380: 
                    381:        if( yyn == 0 ){ /* error */
                    382:                /* error ... attempt to resume parsing */
                    383: 
                    384:                switch( yyerrflag ){
                    385: 
                    386:                case 0:   /* brand new error */
                    387: 
                    388:                        yyerror( "syntax error" );
                    389:                yyerrlab:
                    390:                        ++yynerrs;
                    391: 
                    392:                case 1:
                    393:                case 2: /* incompletely recovered error ... try again */
                    394: 
                    395:                        yyerrflag = 3;
                    396: 
                    397:                        /* find a state where "error" is a legal shift action */
                    398: 
                    399:                        while ( yyps >= yys ) {
                    400:                           yyn = yypact[*yyps] + YYERRCODE;
                    401:                           if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
                    402:                              yystate = yyact[yyn];  /* simulate a shift of "error" */
                    403:                              goto yystack;
                    404:                              }
                    405:                           yyn = yypact[*yyps];
                    406: 
                    407:                           /* the current yyps has no shift onn "error", pop stack */
                    408: 
                    409: #ifdef YYDEBUG
                    410:                           if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
                    411: #endif
                    412:                           --yyps;
                    413:                           --yypv;
                    414:                           }
                    415: 
                    416:                        /* there is no state on the stack with an error shift ... abort */
                    417: 
                    418:        yyabort:
                    419:                        return(1);
                    420: 
                    421: 
                    422:                case 3:  /* no shift yet; clobber input char */
                    423: 
                    424: #ifdef YYDEBUG
                    425:                        if( yydebug ) printf( "error recovery discards char %d\n", yychar );
                    426: #endif
                    427: 
                    428:                        if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
                    429:                        yychar = -1;
                    430:                        goto yynewstate;   /* try again in the same state */
                    431: 
                    432:                        }
                    433: 
                    434:                }
                    435: 
                    436:        /* reduction by production yyn */
                    437: 
                    438: #ifdef YYDEBUG
                    439:                if( yydebug ) printf("reduce %d\n",yyn);
                    440: #endif
                    441:                yyps -= yyr2[yyn];
                    442:                yypvt = yypv;
                    443:                yypv -= yyr2[yyn];
                    444:                yyval = yypv[1];
                    445:                yym=yyn;
                    446:                        /* consult goto table to find next state */
                    447:                yyn = yyr1[yyn];
                    448:                yyj = yypgo[yyn] + *yyps + 1;
                    449:                if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
                    450:                switch(yym){
                    451:                        
                    452: case 1:
                    453: # line 70 "conf_read.y"
                    454: {make_type(yypvt[-1].strval, yypvt[-0].filt);} break;
                    455: case 2:
                    456: # line 73 "conf_read.y"
                    457: {(void) strcpy(yyval.strval, yypvt[-0].strval);} break;
                    458: case 3:
                    459: # line 76 "conf_read.y"
                    460: {(void) strcpy(yyval.strval, yypvt[-0].strval);} break;
                    461: case 4:
                    462: # line 77 "conf_read.y"
                    463: {(void) strcpy(yyval.strval, "\0");} break;
                    464: case 5:
                    465: # line 80 "conf_read.y"
                    466: {yyval.filt = make_parent_filter(yypvt[-4].symbol, yypvt[-3].filt, yypvt[-2].filt, yypvt[-1].filt);} break;
                    467: case 6:
                    468: # line 81 "conf_read.y"
                    469: {yyval.filt = make_parent_filter(yypvt[-2].symbol, yypvt[-1].filt, (filt_struct *) 0,(filt_struct *) 0);} break;
                    470: case 7:
                    471: # line 82 "conf_read.y"
                    472: {yyval.filt = yypvt[-0].filt;} break;
                    473: case 8:
                    474: # line 85 "conf_read.y"
                    475: {yyval.filt = link_filters(yypvt[-1].filt, yypvt[-0].filt);} break;
                    476: case 9:
                    477: # line 86 "conf_read.y"
                    478: {yyval.filt = yypvt[-0].filt;} break;
                    479: case 10:
                    480: # line 87 "conf_read.y"
                    481: {yyval.filt = (filt_struct *) 0;} break;
                    482: case 11:
                    483: # line 90 "conf_read.y"
                    484: {yyval.filt = yypvt[-0].filt;} break;
                    485: case 12:
                    486: # line 91 "conf_read.y"
                    487: {yyval.filt = yypvt[-0].filt;} break;
                    488: case 13:
                    489: # line 94 "conf_read.y"
                    490: {yyval.filt = make_item_filter(yypvt[-3].strval, yypvt[-2].symbol, yypvt[-1].strval);} break;
                    491: case 14:
                    492: # line 97 "conf_read.y"
                    493: {yyval.symbol = yypvt[-0].symbol;} break;
                    494: case 15:
                    495: # line 98 "conf_read.y"
                    496: {yyval.symbol = yypvt[-0].symbol;} break;
                    497: case 16:
                    498: # line 99 "conf_read.y"
                    499: {yyval.symbol = yypvt[-0].symbol;} break;
                    500: case 17:
                    501: # line 102 "conf_read.y"
                    502: {yyval.symbol = yypvt[-0].symbol;} break;
                    503: case 18:
                    504: # line 103 "conf_read.y"
                    505: {yyval.symbol = yypvt[-0].symbol;} break;
                    506:                }
                    507:                goto yystack;  /* stack new state and value */
                    508: 
                    509:        }

unix.superglobalmegacorp.com

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