From bcdef59c3c8c222c23b8184c48cedcc5cc88357c Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 20 Mar 2016 12:05:07 -0500 Subject: [PATCH] Lemon update 2015-11-09 14:11:37 on branch trunk - Size reduction and performance improvement in the stack-popping logic of the Lemon-generated parser. (user: drh) --- tools/lemon/lempar.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/tools/lemon/lempar.c b/tools/lemon/lempar.c index 13ea60068..dbdccc0e7 100644 --- a/tools/lemon/lempar.c +++ b/tools/lemon/lempar.c @@ -334,25 +334,19 @@ static void yy_destructor( ** ** If there is a destructor routine associated with the token which ** is popped from the stack, then call it. -** -** Return the major token number for the symbol popped. */ -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - if( pParser->yyidx<0 ) return 0; +static void yy_pop_parser_stack(yyParser *pParser){ + yyStackEntry *yytos; + assert( pParser->yyidx>=0 ); + yytos = &pParser->yystack[pParser->yyidx--]; #ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ + if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sPopping %s\n", yyTracePrompt, yyTokenName[yytos->major]); } #endif - yymajor = yytos->major; - yy_destructor(pParser, yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; + yy_destructor(pParser, yytos->major, &yytos->minor); } /*