1: #if !defined(lint) && defined(DOSCCS)
   2: static char yaccpar_sccsid[] = "@(#)yaccpar	4.1	(Berkeley)	2/11/83";
   3: #endif
   4: 
   5: #
   6: # define YYFLAG -1000
   7: # define YYERROR goto yyerrlab
   8: # define YYACCEPT return(0)
   9: # define YYABORT return(1)
  10: 
  11: /*	parser for yacc output	*/
  12: 
  13: #ifdef YYDEBUG
  14: int yydebug = 0; /* 1 for debugging */
  15: #endif
  16: YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
  17: int yychar = -1; /* current input token number */
  18: int yynerrs = 0;  /* number of errors */
  19: short yyerrflag = 0;  /* error recovery flag */
  20: 
  21: yyparse() {
  22: 
  23:     short yys[YYMAXDEPTH];
  24:     short yyj, yym;
  25:     register YYSTYPE *yypvt;
  26:     register short yystate, *yyps, yyn;
  27:     register YYSTYPE *yypv;
  28:     register short *yyxi;
  29: 
  30:     yystate = 0;
  31:     yychar = -1;
  32:     yynerrs = 0;
  33:     yyerrflag = 0;
  34:     yyps= &yys[-1];
  35:     yypv= &yyv[-1];
  36: 
  37:  yystack:    /* put a state and value onto the stack */
  38: 
  39: #ifdef YYDEBUG
  40:     if( yydebug  ) printf( "state %d, char 0%o\n", yystate, yychar );
  41: #endif
  42:         if( ++yyps> &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
  43:         *yyps = yystate;
  44:         ++yypv;
  45:         *yypv = yyval;
  46: 
  47:  yynewstate:
  48: 
  49:     yyn = yypact[yystate];
  50: 
  51:     if( yyn<= YYFLAG ) goto yydefault; /* simple state */
  52: 
  53:     if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
  54:     if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;
  55: 
  56:     if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
  57:         yychar = -1;
  58:         yyval = yylval;
  59:         yystate = yyn;
  60:         if( yyerrflag > 0 ) --yyerrflag;
  61:         goto yystack;
  62:         }
  63: 
  64:  yydefault:
  65:     /* default state action */
  66: 
  67:     if( (yyn=yydef[yystate]) == -2 ) {
  68:         if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
  69:         /* look through exception table */
  70: 
  71:         for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */
  72: 
  73:         while( *(yyxi+=2) >= 0 ){
  74:             if( *yyxi == yychar ) break;
  75:             }
  76:         if( (yyn = yyxi[1]) < 0 ) return(0);   /* accept */
  77:         }
  78: 
  79:     if( yyn == 0 ){ /* error */
  80:         /* error ... attempt to resume parsing */
  81: 
  82:         switch( yyerrflag ){
  83: 
  84:         case 0:   /* brand new error */
  85: 
  86:             yyerror( "syntax error" );
  87:         yyerrlab:
  88:             ++yynerrs;
  89: 
  90:         case 1:
  91:         case 2: /* incompletely recovered error ... try again */
  92: 
  93:             yyerrflag = 3;
  94: 
  95:             /* find a state where "error" is a legal shift action */
  96: 
  97:             while ( yyps >= yys ) {
  98:                yyn = yypact[*yyps] + YYERRCODE;
  99:                if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
 100:                   yystate = yyact[yyn];  /* simulate a shift of "error" */
 101:                   goto yystack;
 102:                   }
 103:                yyn = yypact[*yyps];
 104: 
 105:                /* the current yyps has no shift onn "error", pop stack */
 106: 
 107: #ifdef YYDEBUG
 108:                if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
 109: #endif
 110:                --yyps;
 111:                --yypv;
 112:                }
 113: 
 114:             /* there is no state on the stack with an error shift ... abort */
 115: 
 116:     yyabort:
 117:             return(1);
 118: 
 119: 
 120:         case 3:  /* no shift yet; clobber input char */
 121: 
 122: #ifdef YYDEBUG
 123:             if( yydebug ) printf( "error recovery discards char %d\n", yychar );
 124: #endif
 125: 
 126:             if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
 127:             yychar = -1;
 128:             goto yynewstate;   /* try again in the same state */
 129: 
 130:             }
 131: 
 132:         }
 133: 
 134:     /* reduction by production yyn */
 135: 
 136: #ifdef YYDEBUG
 137:         if( yydebug ) printf("reduce %d\n",yyn);
 138: #endif
 139:         yyps -= yyr2[yyn];
 140:         yypvt = yypv;
 141:         yypv -= yyr2[yyn];
 142:         yyval = yypv[1];
 143:         yym=yyn;
 144:             /* consult goto table to find next state */
 145:         yyn = yyr1[yyn];
 146:         yyj = yypgo[yyn] + *yyps + 1;
 147:         if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
 148:         switch(yym){
 149:             $A
 150:         }
 151:         goto yystack;  /* stack new state and value */
 152: 
 153:     }

Defined functions

yyparse defined in line 21; never used

Defined variables

yaccpar_sccsid defined in line 2; never used
yychar defined in line 17; used 15 times
yydebug defined in line 14; used 4 times
yyerrflag defined in line 19; used 5 times
yynerrs defined in line 18; used 2 times

Defined macros

YYABORT defined in line 9; never used
YYACCEPT defined in line 8; never used
YYERROR defined in line 7; never used
YYFLAG defined in line 6; used 1 times
  • in line 51
Last modified: 1995-05-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2034
Valid CSS Valid XHTML 1.0 Strict