** Perform a reduce action and the shift that must immediately ** follow the reduce. ** ** The yyLookahead and yyLookaheadToken parameters provide reduce actions ** access to the lookahead token (if any). The yyLookahead will be YYNOCODE ** if the lookahead token has already been consumed. As this procedure is ** only called from one place, optimizing compilers will in-line it, which ** means th
| 708 | ** means that the extra parameters have no performance impact. |
| 709 | */ |
| 710 | static YYACTIONTYPE yy_reduce( |
| 711 | yyParser *yypParser, /* The parser */ |
| 712 | unsigned int yyruleno, /* Number of the rule by which to reduce */ |
| 713 | int yyLookahead, /* Lookahead token, or YYNOCODE if none */ |
| 714 | ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ |
| 715 | ParseCTX_PDECL /* %extra_context */ |
| 716 | ){ |
| 717 | int yygoto; /* The next state */ |
| 718 | YYACTIONTYPE yyact; /* The next action */ |
| 719 | yyStackEntry *yymsp; /* The top of the parser's stack */ |
| 720 | int yysize; /* Amount to pop the stack */ |
| 721 | ParseARG_FETCH |
| 722 | (void)yyLookahead; |
| 723 | (void)yyLookaheadToken; |
| 724 | yymsp = yypParser->yytos; |
| 725 | #ifndef NDEBUG |
| 726 | if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ |
| 727 | yysize = yyRuleInfoNRhs[yyruleno]; |
| 728 | if( yysize ){ |
| 729 | fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", |
| 730 | yyTracePrompt, |
| 731 | yyruleno, yyRuleName[yyruleno], |
| 732 | yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action", |
| 733 | yymsp[yysize].stateno); |
| 734 | }else{ |
| 735 | fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n", |
| 736 | yyTracePrompt, yyruleno, yyRuleName[yyruleno], |
| 737 | yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action"); |
| 738 | } |
| 739 | } |
| 740 | #endif /* NDEBUG */ |
| 741 | |
| 742 | /* Check that the stack is large enough to grow by a single entry |
| 743 | ** if the RHS of the rule is empty. This ensures that there is room |
| 744 | ** enough on the stack to push the LHS value */ |
| 745 | if( yyRuleInfoNRhs[yyruleno]==0 ){ |
| 746 | #ifdef YYTRACKMAXSTACKDEPTH |
| 747 | if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ |
| 748 | yypParser->yyhwm++; |
| 749 | assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); |
| 750 | } |
| 751 | #endif |
| 752 | #if YYSTACKDEPTH>0 |
| 753 | if( yypParser->yytos>=yypParser->yystackEnd ){ |
| 754 | yyStackOverflow(yypParser); |
| 755 | /* The call to yyStackOverflow() above pops the stack until it is |
| 756 | ** empty, causing the main parser loop to exit. So the return value |
| 757 | ** is never used and does not matter. */ |
| 758 | return 0; |
| 759 | } |
| 760 | #else |
| 761 | if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ |
| 762 | if( yyGrowStack(yypParser) ){ |
| 763 | yyStackOverflow(yypParser); |
| 764 | /* The call to yyStackOverflow() above pops the stack until it is |
| 765 | ** empty, causing the main parser loop to exit. So the return value |
| 766 | ** is never used and does not matter. */ |
| 767 | return 0; |
no test coverage detected