MCPcopy Create free account
hub / github.com/carbonengine/trinity / yy_reduce

Function yy_reduce

shadercompiler/lempar.c:710–805  ·  view source on GitHub ↗

** 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

Source from the content-addressed store, hash-verified

708** means that the extra parameters have no performance impact.
709*/
710static 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;

Callers 1

ParseFunction · 0.70

Calls 4

yyStackOverflowFunction · 0.70
yyGrowStackFunction · 0.70
yy_find_reduce_actionFunction · 0.70
yyTraceShiftFunction · 0.70

Tested by

no test coverage detected