diff --git a/manifest b/manifest index bc778af086..66320996d1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\sprevious\scheck-in\s((6755))\sput\sin\smore\syytestcase()\smacros\sthan\sare\ncalled\sfor.\s\sThis\scheck-in\saddresses\sthat\sproblem.\s(CVS\s6756) -D 2009-06-12T15:47:34 +C Change\slemon\sso\sthat\sit\sdoes\snot\sgenerate\syytestcase()\smacros\son\sdestructor\ncases\ssince\sdestructors\sare\scommonly\sunreachable\sin\sa\sreasonable\sgrammar.\nFor\sthe\sreduce-rule\sswitch,\sgather\sall\sno-ops\sinto\sthe\s"default:"\scase.\s(CVS\s6757) +D 2009-06-12T17:46:20 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 8b8fb7823264331210cddf103831816c286ba446 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -714,7 +714,7 @@ F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439 F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4 F tool/genfkey.test 405a43d54f1646bfaa7a84b03bb959aef62a3a49 -F tool/lemon.c 890d999c32e5c3f98bad406133a6fab47f8bec06 +F tool/lemon.c 0eb9829c494dfcea449de36ad677efe7f0742801 F tool/lempar.c 2ed70b3fc896a47e07fedfe543324f008f53d223 F tool/mkkeywordhash.c 511a848b2ac7a3d93f36adc1e1086b4c5741224b F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x @@ -734,7 +734,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 -P fe9c9177340a3dc372ffa1b851030d005e0c46db -R 471f9a46f36f6b04df4a508ac9988c8f +P a5b182f93b9e57754c8b9507cf491a7bbf0fd127 +R 487e6d753f4accfc816b85167f6e8a2b U drh -Z 08dd3a787d4f92b742186e9b39413caa +Z 44d7634c369a18c617752b13ad1a8da2 diff --git a/manifest.uuid b/manifest.uuid index e0bbc535d7..83d3682cd6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a5b182f93b9e57754c8b9507cf491a7bbf0fd127 \ No newline at end of file +caebfe82cb1b1215a85ed48fe97360c5422c52e0 \ No newline at end of file diff --git a/tool/lemon.c b/tool/lemon.c index 167b136982..8336e9a1ba 100644 --- a/tool/lemon.c +++ b/tool/lemon.c @@ -3862,12 +3862,9 @@ int mhflag; /* Output in makeheaders format if true */ if( sp==0 || sp->type!=TERMINAL ) continue; if( once ){ fprintf(out, " /* TERMINAL Destructor */\n"); lineno++; - fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; once = 0; - }else{ - fprintf(out," case %d: /* %s */ yytestcase(yymajor==%d)\n", - sp->index, sp->name, sp->index); lineno++; } + fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; } for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); if( insymbol ){ @@ -3884,13 +3881,9 @@ int mhflag; /* Output in makeheaders format if true */ sp->index<=0 || sp->destructor!=0 ) continue; if( once ){ fprintf(out, " /* Default NON-TERMINAL Destructor */\n"); lineno++; - fprintf(out," case %d: /* %s */\n", - sp->index, sp->name); lineno++; once = 0; - }else{ - fprintf(out," case %d: /* %s */ yytestcase(yymajor==%d);\n", - sp->index, sp->name, sp->index); lineno++; } + fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; dflt_sp = sp; } if( dflt_sp!=0 ){ @@ -3909,8 +3902,8 @@ int mhflag; /* Output in makeheaders format if true */ if( sp2 && sp2->type!=TERMINAL && sp2->destructor && sp2->dtnum==sp->dtnum && strcmp(sp->destructor,sp2->destructor)==0 ){ - fprintf(out," case %d: /* %s */ yytestcase(yymajor==%d);\n", - sp2->index, sp2->name, sp2->index); lineno++; + fprintf(out," case %d: /* %s */\n", + sp2->index, sp2->name); lineno++; sp2->destructor = 0; } } @@ -3938,9 +3931,11 @@ int mhflag; /* Output in makeheaders format if true */ for(rp=lemp->rule; rp; rp=rp->next){ translate_code(lemp, rp); } + /* First output rules other than the default: rule */ for(rp=lemp->rule; rp; rp=rp->next){ - struct rule *rp2; + struct rule *rp2; /* Other rules with the same action */ if( rp->code==0 ) continue; + if( rp->code[0]=='\n' && rp->code[1]==0 ) continue; /* Will be default: */ fprintf(out," case %d: /* ", rp->index); writeRuleText(out, rp); fprintf(out, " */\n"); lineno++; @@ -3954,7 +3949,19 @@ int mhflag; /* Output in makeheaders format if true */ } emit_code(out,rp,lemp,&lineno); fprintf(out," break;\n"); lineno++; + rp->code = 0; } + /* Finally, output the default: rule. We choose as the default: all + ** empty actions. */ + fprintf(out," default:\n"); lineno++; + for(rp=lemp->rule; rp; rp=rp->next){ + if( rp->code==0 ) continue; + assert( rp->code[0]=='\n' && rp->code[1]==0 ); + fprintf(out," /* (%d) ", rp->index); + writeRuleText(out, rp); + fprintf(out, " */ yytestcase(yyruleno==%d);\n", rp->index); lineno++; + } + fprintf(out," break;\n"); lineno++; tplt_xfer(lemp->name,in,out,&lineno); /* Generate code which executes if a parse fails */