bootparse.c
来自「PostgreSQL7.4.6 for Linux」· C语言 代码 · 共 1,634 行 · 第 1/3 页
C
1,634 行
Int_yychar = YYLEX; } if (Int_yychar <= YYEOF) { Int_yychar = Int_yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { Int_yytoken = YYTRANSLATE (Int_yychar); YYDSYMPRINTF ("Next token is", Int_yytoken, &Int_yylval, &Int_yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ Int_yyn += Int_yytoken; if (Int_yyn < 0 || YYLAST < Int_yyn || Int_yycheck[Int_yyn] != Int_yytoken) goto Int_yydefault; Int_yyn = Int_yytable[Int_yyn]; if (Int_yyn <= 0) { if (Int_yyn == 0 || Int_yyn == YYTABLE_NINF) goto Int_yyerrlab; Int_yyn = -Int_yyn; goto Int_yyreduce; } if (Int_yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ YYDPRINTF ((stderr, "Shifting token %s, ", Int_yytname[Int_yytoken])); /* Discard the token being shifted unless it is eof. */ if (Int_yychar != YYEOF) Int_yychar = YYEMPTY; *++Int_yyvsp = Int_yylval; /* Count tokens shifted since error; after three, turn off error status. */ if (Int_yyerrstatus) Int_yyerrstatus--; Int_yystate = Int_yyn; goto Int_yynewstate;/*-----------------------------------------------------------.| Int_yydefault -- do the default action for the current state. |`-----------------------------------------------------------*/Int_yydefault: Int_yyn = Int_yydefact[Int_yystate]; if (Int_yyn == 0) goto Int_yyerrlab; goto Int_yyreduce;/*-----------------------------.| Int_yyreduce -- Do a reduction. |`-----------------------------*/Int_yyreduce: /* Int_yyn is the number of a rule to reduce with. */ Int_yylen = Int_yyr2[Int_yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ Int_yyval = Int_yyvsp[1-Int_yylen]; YY_REDUCE_PRINT (Int_yyn); switch (Int_yyn) { case 13:#line 131 "bootparse.y" { do_start(); boot_openrel(LexIDStr(Int_yyvsp[0].ival)); do_end(); } break; case 14:#line 140 "bootparse.y" { do_start(); closerel(LexIDStr(Int_yyvsp[0].ival)); do_end(); } break; case 15:#line 146 "bootparse.y" { do_start(); closerel(NULL); do_end(); } break; case 16:#line 155 "bootparse.y" { do_start(); numattr = 0; elog(DEBUG4, "creating%s%s relation %s", Int_yyvsp[-4].ival ? " bootstrap" : "", Int_yyvsp[-3].ival ? " shared" : "", LexIDStr(Int_yyvsp[-1].ival)); } break; case 17:#line 164 "bootparse.y" { do_end(); } break; case 18:#line 168 "bootparse.y" { TupleDesc tupdesc; do_start(); tupdesc = CreateTupleDesc(numattr, !(Int_yyvsp[-6].ival), attrtypes); if (Int_yyvsp[-8].ival) { if (boot_reldesc) { elog(DEBUG4, "create bootstrap: warning, open relation exists, closing first"); closerel(NULL); } boot_reldesc = heap_create(LexIDStr(Int_yyvsp[-5].ival), PG_CATALOG_NAMESPACE, tupdesc, Int_yyvsp[-7].ival, true, true); elog(DEBUG4, "bootstrap relation created"); } else { Oid id; id = heap_create_with_catalog(LexIDStr(Int_yyvsp[-5].ival), PG_CATALOG_NAMESPACE, tupdesc, RELKIND_RELATION, Int_yyvsp[-7].ival, ONCOMMIT_NOOP, true); elog(DEBUG4, "relation created with oid %u", id); } do_end(); } break; case 19:#line 210 "bootparse.y" { do_start(); if (Int_yyvsp[0].oidval) elog(DEBUG4, "inserting row with oid %u", Int_yyvsp[0].oidval); else elog(DEBUG4, "inserting row"); num_columns_read = 0; } break; case 20:#line 219 "bootparse.y" { if (num_columns_read != numattr) elog(ERROR, "incorrect number of columns in row (expected %d, got %d)", numattr, num_columns_read); if (boot_reldesc == (Relation) NULL) { elog(ERROR, "relation not open"); err_out(); } InsertOneTuple(Int_yyvsp[-4].oidval); do_end(); } break; case 21:#line 235 "bootparse.y" { do_start(); DefineIndex(makeRangeVar(NULL, LexIDStr(Int_yyvsp[-5].ival)), LexIDStr(Int_yyvsp[-7].ival), LexIDStr(Int_yyvsp[-3].ival), Int_yyvsp[-1].list, false, false, false, NULL, NIL); do_end(); } break; case 22:#line 249 "bootparse.y" { do_start(); DefineIndex(makeRangeVar(NULL, LexIDStr(Int_yyvsp[-5].ival)), LexIDStr(Int_yyvsp[-7].ival), LexIDStr(Int_yyvsp[-3].ival), Int_yyvsp[-1].list, true, false, false, NULL, NIL); do_end(); } break; case 23:#line 262 "bootparse.y" { build_indices(); } break; case 24:#line 267 "bootparse.y" { Int_yyval.list = lappend(Int_yyvsp[-2].list, Int_yyvsp[0].ielem); } break; case 25:#line 268 "bootparse.y" { Int_yyval.list = makeList1(Int_yyvsp[0].ielem); } break; case 26:#line 273 "bootparse.y" { IndexElem *n = makeNode(IndexElem); n->name = LexIDStr(Int_yyvsp[-1].ival); n->expr = NULL; n->opclass = makeList1(makeString(LexIDStr(Int_yyvsp[0].ival))); Int_yyval.ielem = n; } break; case 27:#line 283 "bootparse.y" { Int_yyval.ival = 1; } break; case 28:#line 284 "bootparse.y" { Int_yyval.ival = 0; } break; case 29:#line 288 "bootparse.y" { Int_yyval.ival = 1; } break; case 30:#line 289 "bootparse.y" { Int_yyval.ival = 0; } break; case 31:#line 293 "bootparse.y" { Int_yyval.ival = 1; } break; case 32:#line 294 "bootparse.y" { Int_yyval.ival = 0; } break; case 35:#line 304 "bootparse.y" { if (++numattr > MAXATTR) elog(FATAL, "too many columns"); DefineAttr(LexIDStr(Int_yyvsp[-2].ival),LexIDStr(Int_yyvsp[0].ival),numattr-1); } break; case 36:#line 312 "bootparse.y" { Int_yyval.oidval = atol(LexIDStr(Int_yyvsp[0].ival)); } break; case 37:#line 313 "bootparse.y" { Int_yyval.oidval = (Oid) 0; } break; case 41:#line 324 "bootparse.y" { InsertOneValue(LexIDStr(Int_yyvsp[0].ival), num_columns_read++); } break; case 42:#line 326 "bootparse.y" { InsertOneValue(LexIDStr(Int_yyvsp[0].ival), num_columns_read++); } break; case 43:#line 328 "bootparse.y" { InsertOneNull(num_columns_read++); } break; case 44:#line 332 "bootparse.y" { Int_yyval.ival=Int_yylval.ival; } break; case 45:#line 336 "bootparse.y" { Int_yyval.ival=Int_yylval.ival; } break; }/* Line 991 of yacc.c. */#line 1420 "y.tab.c" Int_yyvsp -= Int_yylen; Int_yyssp -= Int_yylen; YY_STACK_PRINT (Int_yyss, Int_yyssp); *++Int_yyvsp = Int_yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ Int_yyn = Int_yyr1[Int_yyn]; Int_yystate = Int_yypgoto[Int_yyn - YYNTOKENS] + *Int_yyssp; if (0 <= Int_yystate && Int_yystate <= YYLAST && Int_yycheck[Int_yystate] == *Int_yyssp) Int_yystate = Int_yytable[Int_yystate]; else Int_yystate = Int_yydefgoto[Int_yyn - YYNTOKENS]; goto Int_yynewstate;/*------------------------------------.| Int_yyerrlab -- here on detecting error |`------------------------------------*/Int_yyerrlab: /* If not already recovering from an error, report this error. */ if (!Int_yyerrstatus) { ++Int_yynerrs;#if YYERROR_VERBOSE Int_yyn = Int_yypact[Int_yystate]; if (YYPACT_NINF < Int_yyn && Int_yyn < YYLAST) { YYSIZE_T Int_yysize = 0; int Int_yytype = YYTRANSLATE (Int_yychar); char *Int_yymsg; int Int_yyx, Int_yycount; Int_yycount = 0; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ for (Int_yyx = Int_yyn < 0 ? -Int_yyn : 0; Int_yyx < (int) (sizeof (Int_yytname) / sizeof (char *)); Int_yyx++) if (Int_yycheck[Int_yyx + Int_yyn] == Int_yyx && Int_yyx != YYTERROR) Int_yysize += Int_yystrlen (Int_yytname[Int_yyx]) + 15, Int_yycount++; Int_yysize += Int_yystrlen ("syntax error, unexpected ") + 1; Int_yysize += Int_yystrlen (Int_yytname[Int_yytype]); Int_yymsg = (char *) YYSTACK_ALLOC (Int_yysize); if (Int_yymsg != 0) { char *Int_yyp = Int_yystpcpy (Int_yymsg, "syntax error, unexpected "); Int_yyp = Int_yystpcpy (Int_yyp, Int_yytname[Int_yytype]); if (Int_yycount < 5) { Int_yycount = 0; for (Int_yyx = Int_yyn < 0 ? -Int_yyn : 0; Int_yyx < (int) (sizeof (Int_yytname) / sizeof (char *)); Int_yyx++) if (Int_yycheck[Int_yyx + Int_yyn] == Int_yyx && Int_yyx != YYTERROR) { const char *Int_yyq = ! Int_yycount ? ", expecting " : " or "; Int_yyp = Int_yystpcpy (Int_yyp, Int_yyq); Int_yyp = Int_yystpcpy (Int_yyp, Int_yytname[Int_yyx]); Int_yycount++; } } Int_yyerror (Int_yymsg); YYSTACK_FREE (Int_yymsg); } else Int_yyerror ("syntax error; also virtual memory exhausted"); } else#endif /* YYERROR_VERBOSE */ Int_yyerror ("syntax error"); } if (Int_yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ /* Return failure if at end of input. */ if (Int_yychar == YYEOF) { /* Pop the error token. */ YYPOPSTACK; /* Pop the rest of the stack. */ while (Int_yyss < Int_yyssp) { YYDSYMPRINTF ("Error: popping", Int_yystos[*Int_yyssp], Int_yyvsp, Int_yylsp); Int_yydestruct (Int_yystos[*Int_yyssp], Int_yyvsp); YYPOPSTACK; } YYABORT; } YYDSYMPRINTF ("Error: discarding", Int_yytoken, &Int_yylval, &Int_yylloc); Int_yydestruct (Int_yytoken, &Int_yylval); Int_yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ goto Int_yyerrlab2;/*----------------------------------------------------.| Int_yyerrlab1 -- error raised explicitly by an action. |`----------------------------------------------------*/Int_yyerrlab1: /* Suppress GCC warning that Int_yyerrlab1 is unused when no action invokes YYERROR. */#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__) __attribute__ ((__unused__))#endif goto Int_yyerrlab2;/*---------------------------------------------------------------.| Int_yyerrlab2 -- pop states until the error token can be shifted. |`---------------------------------------------------------------*/Int_yyerrlab2: Int_yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { Int_yyn = Int_yypact[Int_yystate]; if (Int_yyn != YYPACT_NINF) { Int_yyn += YYTERROR; if (0 <= Int_yyn && Int_yyn <= YYLAST && Int_yycheck[Int_yyn] == YYTERROR) { Int_yyn = Int_yytable[Int_yyn]; if (0 < Int_yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (Int_yyssp == Int_yyss) YYABORT; YYDSYMPRINTF ("Error: popping", Int_yystos[*Int_yyssp], Int_yyvsp, Int_yylsp); Int_yydestruct (Int_yystos[Int_yystate], Int_yyvsp); Int_yyvsp--; Int_yystate = *--Int_yyssp; YY_STACK_PRINT (Int_yyss, Int_yyssp); } if (Int_yyn == YYFINAL) YYACCEPT; YYDPRINTF ((stderr, "Shifting error token, ")); *++Int_yyvsp = Int_yylval; Int_yystate = Int_yyn; goto Int_yynewstate;/*-------------------------------------.| Int_yyacceptlab -- YYACCEPT comes here. |`-------------------------------------*/Int_yyacceptlab: Int_yyresult = 0; goto Int_yyreturn;/*-----------------------------------.| Int_yyabortlab -- YYABORT comes here. |`-----------------------------------*/Int_yyabortlab: Int_yyresult = 1; goto Int_yyreturn;#ifndef Int_yyoverflow/*----------------------------------------------.| Int_yyoverflowlab -- parser overflow comes here. |`----------------------------------------------*/Int_yyoverflowlab: Int_yyerror ("parser stack overflow"); Int_yyresult = 2; /* Fall through. */#endifInt_yyreturn:#ifndef Int_yyoverflow if (Int_yyss != Int_yyssa) YYSTACK_FREE (Int_yyss);#endif return Int_yyresult;}#line 338 "bootparse.y"#include "bootscanner.c"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?