📄 grammar.tab.c
字号:
{ yyn = yytable[yyn]; goto yyreduce; } if (yyerrflag) goto yyinrecovery;#ifdef lint goto yynewerror;#endifyynewerror: yyerror("syntax error");#ifdef lint goto yyerrlab;#endifyyerrlab: ++yynerrs;yyinrecovery: if (yyerrflag < 3) { yyerrflag = 3; for (;;) { if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) {#if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);#endif if (yyssp >= yyss + yystacksize - 1) { goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; *++yyvsp = yylval; goto yyloop; } else {#if YYDEBUG if (yydebug) printf("%sdebug: error recovery discarding state %d\n", YYPREFIX, *yyssp);#endif if (yyssp <= yyss) goto yyabort; --yyssp; --yyvsp; } } } else { if (yychar == 0) goto yyabort;#if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); }#endif yychar = (-1); goto yyloop; }yyreduce:#if YYDEBUG if (yydebug) printf("%sdebug: state %d, reducing by rule %d (%s)\n", YYPREFIX, yystate, yyn, yyrule[yyn]);#endif yym = yylen[yyn]; yyval = yyvsp[1-yym]; switch (yyn) {case 10:#line 179 "grammar.y"{ yyerrok; }break;case 11:#line 183 "grammar.y"{ yyerrok; }break;case 13:#line 194 "grammar.y"{ /* Provide an empty action here so bison will not complain about * incompatible types in the default action it normally would * have generated. */ }break;case 14:#line 201 "grammar.y"{ /* empty */ }break;case 15:#line 208 "grammar.y"{#if OPT_LINTLIBRARY if (types_out && want_typedef()) { gen_declarations(&yyvsp[-1].decl_spec, (DeclaratorList *)0); flush_varargs(); }#endif free_decl_spec(&yyvsp[-1].decl_spec); end_typedef(); }break;case 16:#line 219 "grammar.y"{ if (func_params != NULL) { set_param_types(func_params, &yyvsp[-2].decl_spec, &yyvsp[-1].decl_list); } else { gen_declarations(&yyvsp[-2].decl_spec, &yyvsp[-1].decl_list);#if OPT_LINTLIBRARY flush_varargs();#endif free_decl_list(&yyvsp[-1].decl_list); } free_decl_spec(&yyvsp[-2].decl_spec); end_typedef(); }break;case 17:#line 233 "grammar.y"{ cur_decl_spec_flags = yyvsp[0].decl_spec.flags; free_decl_spec(&yyvsp[0].decl_spec); }break;case 18:#line 238 "grammar.y"{ end_typedef(); }break;case 19:#line 245 "grammar.y"{ begin_typedef(); }break;case 20:#line 249 "grammar.y"{ begin_typedef(); }break;case 23:#line 261 "grammar.y"{ int flags = cur_decl_spec_flags; /* If the typedef is a pointer type, then reset the short type * flags so it does not get promoted. */ if (strcmp(yyvsp[0].declarator->text, yyvsp[0].declarator->name) != 0) flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT); new_symbol(typedef_names, yyvsp[0].declarator->name, NULL, flags); free_declarator(yyvsp[0].declarator); }break;case 24:#line 273 "grammar.y"{ int flags = cur_decl_spec_flags; if (strcmp(yyvsp[0].declarator->text, yyvsp[0].declarator->name) != 0) flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT); new_symbol(typedef_names, yyvsp[0].declarator->name, NULL, flags); free_declarator(yyvsp[0].declarator); }break;case 25:#line 285 "grammar.y"{ check_untagged(&yyvsp[-1].decl_spec); if (yyvsp[0].declarator->func_def == FUNC_NONE) { yyerror("syntax error"); YYERROR; } func_params = &(yyvsp[0].declarator->head->params); func_params->begin_comment = cur_file->begin_comment; func_params->end_comment = cur_file->end_comment; }break;case 26:#line 296 "grammar.y"{ /* If we're converting to K&R and we've got a nominally K&R * function which has a parameter which is ANSI (i.e., a prototyped * function pointer), then we must override the deciphered value of * 'func_def' so that the parameter will be converted. */ if (func_style == FUNC_TRADITIONAL && haveAnsiParam() && yyvsp[-3].declarator->head->func_def == func_style) { yyvsp[-3].declarator->head->func_def = FUNC_BOTH; } func_params = NULL; if (cur_file->convert) gen_func_definition(&yyvsp[-4].decl_spec, yyvsp[-3].declarator); gen_prototype(&yyvsp[-4].decl_spec, yyvsp[-3].declarator);#if OPT_LINTLIBRARY flush_varargs();#endif free_decl_spec(&yyvsp[-4].decl_spec); free_declarator(yyvsp[-3].declarator); }break;case 28:#line 321 "grammar.y"{ if (yyvsp[0].declarator->func_def == FUNC_NONE) { yyerror("syntax error"); YYERROR; } func_params = &(yyvsp[0].declarator->head->params); func_params->begin_comment = cur_file->begin_comment; func_params->end_comment = cur_file->end_comment; }break;case 29:#line 331 "grammar.y"{ DeclSpec decl_spec; func_params = NULL; new_decl_spec(&decl_spec, dft_decl_spec(), yyvsp[-4].declarator->begin, DS_NONE); if (cur_file->convert) gen_func_definition(&decl_spec, yyvsp[-4].declarator); gen_prototype(&decl_spec, yyvsp[-4].declarator);#if OPT_LINTLIBRARY flush_varargs();#endif free_decl_spec(&decl_spec); free_declarator(yyvsp[-4].declarator); }break;case 36:#line 362 "grammar.y"{ join_decl_specs(&yyval.decl_spec, &yyvsp[-1].decl_spec, &yyvsp[0].decl_spec); free(yyvsp[-1].decl_spec.text); free(yyvsp[0].decl_spec.text); }break;case 40:#line 377 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE); }break;case 41:#line 381 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_EXTERN); }break;case 42:#line 385 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE); }break;case 43:#line 389 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_STATIC); }break;case 44:#line 393 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_INLINE); }break;case 45:#line 397 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_JUNK); }break;case 46:#line 404 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_CHAR); }break;case 47:#line 408 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE); }break;case 48:#line 412 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_FLOAT); }break;case 49:#line 416 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE); }break;case 50:#line 420 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE); }break;case 51:#line 424 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_SHORT); }break;case 52:#line 428 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE); }break;case 53:#line 432 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE); }break;case 54:#line 436 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE); }break;case 55:#line 440 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_CHAR); }break;case 56:#line 444 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE); }break;case 57:#line 448 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE); }break;case 58:#line 452 "grammar.y"{ Symbol *s; s = find_symbol(typedef_names, yyvsp[0].text.text); if (s != NULL) new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, s->flags); }break;case 61:#line 464 "grammar.y"{ new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE); }break;case 62:#line 468 "grammar.y"{ /* This rule allows the <pointer> nonterminal to scan #define * names as if they were type modifiers. */ Symbol *s; s = find_symbol(define_names, yyvsp[0].text.text); if (s != NULL) new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, s->flags); }break;case 63:#line 481 "grammar.y"{ char *s; if ((s = implied_typedef()) == 0) (void)sprintf(s = buf, "%s %s", yyvsp[-2].text.text, yyvsp[-1].text.text); new_decl_spec(&yyval.decl_spec, s, yyvsp[-2].text.begin, DS_NONE); }break;case 64:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -