/* line 2 predict2.y */ #include "predict.h" #include #include int i; #define ASCII 257 #define STATA 258 #define READ 259 #define PTIMES 260 #define FORMAT 261 #define ALTQUOTE 262 #define OUTASCII 263 #define MISSING 264 #define LABHEADS 265 #define OUTPUT 266 #define DEBUG 267 #define YYDEBUG 268 #define OPTIONS 269 #define PTIME 270 #define PARMDSN 271 #define PPARM 272 #define ALPHA 273 #define GAMMA 274 #define DELTA 275 #define VAR 276 #define COV 277 #define IDENTIFIER 857 #define CONSTANT 858 #define PTR 888 #define LESSEQ 889 #define GRTEQ 890 #define RSHIFT 891 #define LSHIFT 892 #define EQL 893 #define NOTEQ 894 #define PLUSEQ 895 #define MINUSEQ 896 #define TIMESEQ 897 #define DIVEQ 898 #define MODEQ 899 #define RSHIFTEQ 900 #define LSHIFTEQ 901 #define INC 902 #define DEC 903 #define STRING 904 #define yyclearin yychar = -1 #define yyerrok yyerrflag = 0 extern int yychar; extern short yyerrflag; #ifndef YYMAXDEPTH #define YYMAXDEPTH 150 #endif #ifndef YYSTYPE #define YYSTYPE int #endif YYSTYPE yylval, yyval; #define YYERRCODE 256 /* line 107 predict2.y */ void KeywordInstall() { lexinstall("ascii", ASCII); lexinstall("stata", STATA); lexinstall("options", OPTIONS); lexinstall("format", FORMAT); lexinstall("read", READ); lexinstall("debug", DEBUG); lexinstall("yydebug", YYDEBUG); lexinstall("altquote", ALTQUOTE); lexinstall("missing", MISSING); lexinstall("labheads", LABHEADS); lexinstall("output", OUTPUT); lexinstall("parmdsn", PARMDSN); lexinstall("pparm", PPARM); lexinstall("outascii", OUTASCII); lexinstall("ptime", PTIME); lexinstall("alpha", ALPHA); lexinstall("gamma", GAMMA); lexinstall("delta", DELTA); lexinstall("var", VAR); lexinstall("cov", COV); } short yyexca[] ={ -1, 1, 0, -1, -2, 0, }; #define YYNPROD 63 #define YYLAST 847 short yyact[]={ 74, 67, 66, 65, 64, 63, 59, 75, 79, 80, 81, 76, 77, 79, 80, 81, 12, 16, 14, 82, 15, 83, 69, 70, 68, 19, 62, 57, 13, 17, 20, 18, 78, 61, 56, 55, 22, 91, 72, 2, 32, 21, 24, 11, 10, 9, 8, 7, 31, 58, 60, 6, 5, 4, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 84, 71, 0, 0, 0, 0, 0, 0, 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 85, 86, 0, 0, 0, 0, 0, 0, 0, 90, 0, 92, 0, 0, 94, 95, 0, 0, 0, 88, 89, 0, 0, 0, 0, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 34, 35, 36, 37, 38, 39, 53, 54, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 33, 34, 35, 36, 37, 38, 39, 53, 54, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 33, 34, 35, 36, 37, 38, 39, 53, 54, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 28, 27, 29, 30, 0, 25, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52 }; short yypact[]={ -241,-241,-1000, -23, 5, -11, -24, -25, -32, -53, -26, -33,-899,-1000,-1000,-900,-901,-1000,-1000,-902, -903,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000, -37, -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000, -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000, -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000, -17,-1000, -17,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-904,-851, -1000,-1000,-1000,-265,-1000, -20, -17, -17, -20,-1000, -1000,-1000,-1000,-1000,-1000,-260,-260,-1000, -20, -7, -20,-260,-1000, -20, -20,-1000 }; short yypgo[]={ 0, 55, 39, 54, 53, 52, 51, 47, 46, 45, 44, 43, 40, 42, 22, 19, 38, 32 }; short yyr1[]={ 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 7, 5, 5, 6, 10, 11, 4, 4, 13, 13, 13, 13, 13, 13, 8, 8, 9, 9, 16, 16, 16, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 17, 17, 17, 14, 14, 15, 15 }; short yyr2[]={ 0, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, 3, 1, 1, 5, 1, 3, 6, 8, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; short yychk[]={ -1000, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, 257, 269, 259, 261, 258, 270, 272, 266, 271, -2, 59, 59, -13, 267, 268, 263, 262, 264, 265, 59, -12, 257, 258, 259, 260, 261, 262, 263, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 857, 264, 265, 59, 59, 59, -12, 59, -12, 59, 59, 904, 904, 904, 904, 904, 61, -14, 40, 91, -16, -14, 904, 858, 276, 277, -17, 273, 274, 275, -15, 41, 93, -14, -14, -15, -17, -17, -15, 44, -15, -17, -15, -15 }; short yydef[]={ 0, -2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 14, 0, 0, 27, 29, 0, 0, 1, 3, 4, 20, 21, 22, 23, 24, 0, 26, 5, 15, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 6, 7, 8, 0, 9, 0, 10, 11, 12, 16, 13, 17, 18, 0, 0, 59, 60, 30, 0, 25, 0, 0, 0, 0, 56, 57, 58, 28, 61, 62, 0, 0, 33, 0, 0, 0, 0, 31, 0, 0, 32 }; #define YYFLAG -2000 #define YYERROR goto yyerrlab #define YYACCEPT return(0) #define YYABORT return(1) /* parser for yacc output */ int yydebug = 0; /* 1 for debugging */ YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */ int yychar = -1; /* current input token number */ int yynerrs = 0; /* number of errors */ short yyerrflag = 0; /* error recovery flag */ yyparse() { short yys[YYMAXDEPTH]; short yyj, yym; register YYSTYPE *yypvt; register short yystate, *yyps, yyn; register YYSTYPE *yypv; register short *yyxi; yystate = 0; yychar = -1; yynerrs = 0; yyerrflag = 0; yyps= &yys[-1]; yypv= &yyv[-1]; yystack: /* put a state and value onto the stack */ if( yydebug ) printf( "state %d, char 0%o\n", yystate, yychar ); if( ++yyps> &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); } *yyps = yystate; ++yypv; *yypv = yyval; yynewstate: yyn = yypact[yystate]; if( yyn<= YYFLAG ) goto yydefault; /* simple state */ if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0; if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault; if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */ yychar = -1; yyval = yylval; yystate = yyn; if( yyerrflag > 0 ) --yyerrflag; goto yystack; } yydefault: /* default state action */ if( (yyn=yydef[yystate]) == -2 ) { if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0; /* look through exception table */ for ( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */ while( *(yyxi+=2) >= 0 ){ if( *yyxi == yychar ) break; } if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */ } if( yyn == 0 ){ /* error */ /* error ... attempt to resume parsing */ switch( yyerrflag ){ case 0: /* brand new error */ yyerror( "syntax error" ); yyerrlab: ++yynerrs; case 1: case 2: /* incompletely recovered error ... try again */ yyerrflag = 3; /* find a state where "error" is a legal shift action */ while ( yyps >= yys ) { yyn = yypact[*yyps] + YYERRCODE; if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){ yystate = yyact[yyn]; /* simulate a shift of "error" */ goto yystack; } yyn = yypact[*yyps]; /* the current yyps has no shift on "error", pop stack */ if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] ); --yyps; --yypv; } /* there is no state on the stack with an error shift ... abort */ yyabort: return(1); case 3: /* no shift yet; clobber input char */ if( yydebug ) printf( "error recovery discards char %d\n", yychar ); if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */ yychar = -1; goto yynewstate; /* try again in the same state */ } } /* reduction by production yyn */ if( yydebug ) printf("reduce %d\n",yyn); yyps -= yyr2[yyn]; yypvt = yypv; yypv -= yyr2[yyn]; yyval = yypv[1]; yym=yyn; /* consult goto table to find next state */ yyn = yyr1[yyn]; yyj = yypgo[yyn] + *yyps + 1; if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]]; switch(yym){ case 12: /* line 35 predict2.y */ { input_type=RAW; strcpy(dsn, ident[yypvt[-0]]); } break; case 13: /* line 38 predict2.y */ { input_type=STATAIN; strcpy(dsn, ident[yypvt[-0]]); } break; case 14: /* line 42 predict2.y */ { result=raw_setup(dsn,format); if (result) mxerror(10,dsn); } break; case 15: /* line 47 predict2.y */ { set_readid(ident[yypvt[-0]]); } break; case 16: /* line 51 predict2.y */ { strcpy(format,ident[yypvt[-0]]); } break; case 17: /* line 54 predict2.y */ { strcpy(outdsn,ident[yypvt[-0]]); } break; case 18: /* line 57 predict2.y */ { strcpy(parmdsn,ident[yypvt[-0]]); } break; case 21: /* line 64 predict2.y */ { debug = 1; } break; case 22: /* line 65 predict2.y */ { yydebug = 1; } break; case 23: /* line 66 predict2.y */ { outascii = 1; } break; case 24: /* line 67 predict2.y */ { quotechar = '#'; } break; case 25: /* line 68 predict2.y */ { strcpy(misssym,ident[yypvt[-0]]); } break; case 26: /* line 69 predict2.y */ { labheads = 1; } break; case 28: /* line 74 predict2.y */ { prediction_id[ntimes] = yypvt[-3]; prediction_times[ntimes++] = dend[yypvt[-1]]; } break; case 30: /* line 82 predict2.y */ { prediction_p_type[npred] = yypvt[-0]; prediction_p_id[npred++] = yypvt[-1]; } break; case 31: /* line 88 predict2.y */ { yyval = 3 + (yypvt[-2]*(yypvt[-2]+3))/2; } break; case 32: /* line 89 predict2.y */ { i = (yypvt[-4]>yypvt[-2])?yypvt[-4]:yypvt[-2]; yyval = 3 + (i*(i+1))/2+yypvt[-4]+yypvt[-2]-i; } break; case 33: /* line 90 predict2.y */ { yyval = yypvt[-1]; } break; case 56: /* line 99 predict2.y */ { yyval = 0; } break; case 57: /* line 100 predict2.y */ { yyval = 1; } break; case 58: /* line 101 predict2.y */ { yyval = 2; } break; } goto yystack; /* stack new state and value */ }