📄 parse.c_shipped
字号:
#endif#else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); if (yyfree_stacks) { free (yyss); free (yyvs);#ifdef YYLSP_NEEDED free (yyls);#endif } return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH;#ifndef YYSTACK_USE_ALLOCA yyfree_stacks = 1;#endif yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); __yy_memcpy ((char *)yyss, (char *)yyss1, size * (unsigned int) sizeof (*yyssp)); yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * (unsigned int) sizeof (*yyvsp));#ifdef YYLSP_NEEDED yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); __yy_memcpy ((char *)yyls, (char *)yyls1, size * (unsigned int) sizeof (*yylsp));#endif#endif /* no yyoverflow */ yyssp = yyss + size - 1; yyvsp = yyvs + size - 1;#ifdef YYLSP_NEEDED yylsp = yyls + size - 1;#endif#if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Stack size increased to %d\n", yystacksize);#endif if (yyssp >= yyss + yystacksize - 1) YYABORT; }#if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Entering state %d\n", yystate);#endif goto yybackup; yybackup:/* Do appropriate processing given the current state. *//* Read a lookahead token if we need one and don't already have one. *//* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYFLAG) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) {#if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Reading a token: ");#endif yychar = YYLEX; } /* Convert token to internal form (in yychar1) for indexing tables with */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */#if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Now at end of input.\n");#endif } else { yychar1 = YYTRANSLATE(yychar);#if YYDEBUG != 0 if (yydebug) { fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */#ifdef YYPRINT YYPRINT (stderr, yychar, yylval);#endif fprintf (stderr, ")\n"); }#endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */#if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);#endif /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval;#ifdef YYLSP_NEEDED *++yylsp = yylloc;#endif /* count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate;/* Do the default action for the current state. */yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab;/* Do a reduction. yyn is the number of a rule to reduce with. */yyreduce: yylen = yyr2[yyn]; if (yylen > 0) yyval = yyvsp[1-yylen]; /* implement default value of the action */#if YYDEBUG != 0 if (yydebug) { int i; fprintf (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) fprintf (stderr, "%s ", yytname[yyrhs[i]]); fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); }#endif switch (yyn) {case 3:#line 107 "scripts/genksyms/parse.y"{ is_typedef = 0; is_extern = 0; current_name = NULL; decl_spec = NULL; ; break;}case 4:#line 109 "scripts/genksyms/parse.y"{ free_list(*yyvsp[0], NULL); *yyvsp[0] = NULL; ; break;}case 5:#line 113 "scripts/genksyms/parse.y"{ is_typedef = 1; ; break;}case 6:#line 114 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}case 11:#line 119 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}case 12:#line 120 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}case 13:#line 125 "scripts/genksyms/parse.y"{ if (current_name) { struct string_list *decl = (*yyvsp[0])->next; (*yyvsp[0])->next = NULL; add_symbol(current_name, is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); current_name = NULL; } yyval = yyvsp[0]; ; break;}case 14:#line 138 "scripts/genksyms/parse.y"{ yyval = NULL; ; break;}case 16:#line 144 "scripts/genksyms/parse.y"{ struct string_list *decl = *yyvsp[0]; *yyvsp[0] = NULL; add_symbol(current_name, is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); current_name = NULL; yyval = yyvsp[0]; ; break;}case 17:#line 152 "scripts/genksyms/parse.y"{ struct string_list *decl = *yyvsp[0]; *yyvsp[0] = NULL; free_list(*yyvsp[-1], NULL); *yyvsp[-1] = decl_spec; add_symbol(current_name, is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); current_name = NULL; yyval = yyvsp[0]; ; break;}case 18:#line 165 "scripts/genksyms/parse.y"{ yyval = yyvsp[0] ? yyvsp[0] : yyvsp[-1] ? yyvsp[-1] : yyvsp[-2] ? yyvsp[-2] : yyvsp[-3]; ; break;}case 19:#line 170 "scripts/genksyms/parse.y"{ decl_spec = NULL; ; break;}case 21:#line 175 "scripts/genksyms/parse.y"{ decl_spec = *yyvsp[0]; ; break;}case 22:#line 176 "scripts/genksyms/parse.y"{ decl_spec = *yyvsp[0]; ; break;}case 23:#line 181 "scripts/genksyms/parse.y"{ /* Version 2 checksumming ignores storage class, as that is really irrelevant to the linkage. */ remove_node(yyvsp[0]); yyval = yyvsp[0]; ; break;}case 28:#line 193 "scripts/genksyms/parse.y"{ is_extern = 1; yyval = yyvsp[0]; ; break;}case 29:#line 194 "scripts/genksyms/parse.y"{ is_extern = 0; yyval = yyvsp[0]; ; break;}case 33:#line 205 "scripts/genksyms/parse.y"{ remove_node(yyvsp[-1]); (*yyvsp[0])->tag = SYM_STRUCT; yyval = yyvsp[0]; ; break;}case 34:#line 207 "scripts/genksyms/parse.y"{ remove_node(yyvsp[-1]); (*yyvsp[0])->tag = SYM_UNION; yyval = yyvsp[0]; ; break;}case 35:#line 209 "scripts/genksyms/parse.y"{ remove_node(yyvsp[-1]); (*yyvsp[0])->tag = SYM_ENUM; yyval = yyvsp[0]; ; break;}case 36:#line 213 "scripts/genksyms/parse.y"{ struct string_list *s = *yyvsp[0], *i = *yyvsp[-1], *r; r = copy_node(i); r->tag = SYM_STRUCT; r->next = (*yyvsp[-2])->next; *yyvsp[0] = r; (*yyvsp[-2])->next = NULL; add_symbol(i->string, SYM_STRUCT, s, is_extern); yyval = yyvsp[0]; ; break;}case 37:#line 220 "scripts/genksyms/parse.y"{ struct string_list *s = *yyvsp[0], *i = *yyvsp[-1], *r; r = copy_node(i); r->tag = SYM_UNION; r->next = (*yyvsp[-2])->next; *yyvsp[0] = r; (*yyvsp[-2])->next = NULL; add_symbol(i->string, SYM_UNION, s, is_extern); yyval = yyvsp[0]; ; break;}case 38:#line 227 "scripts/genksyms/parse.y"{ struct string_list *s = *yyvsp[0], *i = *yyvsp[-1], *r; r = copy_node(i); r->tag = SYM_ENUM; r->next = (*yyvsp[-2])->next; *yyvsp[0] = r; (*yyvsp[-2])->next = NULL; add_symbol(i->string, SYM_ENUM, s, is_extern); yyval = yyvsp[0]; ; break;}case 39:#line 235 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}case 40:#line 236 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}case 41:#line 237 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}case 52:#line 251 "scripts/genksyms/parse.y"{ (*yyvsp[0])->tag = SYM_TYPEDEF; yyval = yyvsp[0]; ; break;}case 53:#line 256 "scripts/genksyms/parse.y"{ yyval = yyvsp[0] ? yyvsp[0] : yyvsp[-1]; ; break;}case 54:#line 260 "scripts/genksyms/parse.y"{ yyval = NULL; ; break;}case 57:#line 266 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}case 61:#line 272 "scripts/genksyms/parse.y"{ /* restrict has no effect in prototypes so ignore it */ remove_node(yyvsp[0]); yyval = yyvsp[0]; ; break;}case 62:#line 279 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}case 64:#line 285 "scripts/genksyms/parse.y"{ if (current_name != NULL) { error_with_pos("unexpected second declaration name"); YYERROR; } else { current_name = (*yyvsp[0])->string; yyval = yyvsp[0]; } ; break;}case 65:#line 294 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}case 66:#line 296 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}case 67:#line 298 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}case 68:#line 300 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}case 69:#line 302 "scripts/genksyms/parse.y"{ yyval = yyvsp[0]; ; break;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -