From: Dave Mitchell Date: Sun, 17 Dec 2006 19:42:35 +0000 (+0000) Subject: unify stacks arithmetic in parser X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=05a0316164bed922fc0af38af025db7839ffec55;p=p5sagit%2Fp5-mst-13.2.git unify stacks arithmetic in parser p4raw-id: //depot/perl@29567 --- diff --git a/perly.c b/perly.c index e3f9357..29c8bfa 100644 --- a/perly.c +++ b/perly.c @@ -484,25 +484,20 @@ Perl_yyparse (pTHX) yynsp = yyns; #endif - yystate = 0; + *yyssp = 0; + yyvsp->ival = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; - /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ - yyssp++; - yysetstate: + yystate = *yyssp; + YYDPRINTF ((Perl_debug_log, "Entering state %d\n", yystate)); - *yyssp = yystate; if (yy_type_tab[yystos[yystate]] == toketype_opval && yyvsp->opval) { yyvsp->opval->op_latefree = 1; @@ -628,6 +623,7 @@ Perl_yyparse (pTHX) if (yychar != YYEOF) yychar = YYEMPTY; + *++yyssp = yyn; *++yyvsp = yylval; *++yypsp = PL_comppad; #ifdef DEBUGGING @@ -640,8 +636,6 @@ Perl_yyparse (pTHX) if (yyerrstatus) yyerrstatus--; - yystate = yyn; - goto yynewstate; @@ -736,14 +730,15 @@ Perl_yyparse (pTHX) yynsp -= yylen; #endif + /* 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. */ + *++yyvsp = yyval; *++yypsp = PL_comppad; #ifdef DEBUGGING *++yynsp = (const char *)(yytname [yyr1[yyn]]); #endif - /* 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. */ yyn = yyr1[yyn]; @@ -752,6 +747,8 @@ Perl_yyparse (pTHX) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; + *++yyssp = yystate; + goto yynewstate; @@ -893,14 +890,13 @@ Perl_yyparse (pTHX) YYDPRINTF ((Perl_debug_log, "Shifting error token, ")); + *++yyssp = yyn; *++yyvsp = yylval; *++yypsp = PL_comppad; #ifdef DEBUGGING *++yynsp =""; #endif - yystate = yyn; - goto yynewstate;