Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | The previous check-in ((6755)) put in more yytestcase() macros than are called for. This check-in addresses that problem. (CVS 6756) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a5b182f93b9e57754c8b9507cf491a7b |
User & Date: | drh 2009-06-12 15:47:34.000 |
Context
2009-06-12
| ||
17:46 | Change lemon so that it does not generate yytestcase() macros on destructor cases since destructors are commonly unreachable in a reasonable grammar. For the reduce-rule switch, gather all no-ops into the "default:" case. (CVS 6757) (check-in: caebfe82cb user: drh tags: trunk) | |
15:47 | The previous check-in ((6755)) put in more yytestcase() macros than are called for. This check-in addresses that problem. (CVS 6756) (check-in: a5b182f93b user: drh tags: trunk) | |
13:53 | The lemon parser generator now inserts yytestcase() macros on reduce action and on each destructor, to verify that all have been executed. yytestcase() is a no-op by default but can be set to something more useful inside of %include. (CVS 6755) (check-in: fe9c917734 user: drh tags: trunk) | |
Changes
Changes to tool/lemon.c.
︙ | ︙ | |||
3858 3859 3860 3861 3862 3863 3864 3865 | if( lemp->tokendest ){ int once = 1; for(i=0; i<lemp->nsymbol; i++){ struct symbol *sp = lemp->symbols[i]; if( sp==0 || sp->type!=TERMINAL ) continue; if( once ){ fprintf(out, " /* TERMINAL Destructor */\n"); lineno++; once = 0; | > | | | > > > | | | > | < | 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 | if( lemp->tokendest ){ int once = 1; for(i=0; i<lemp->nsymbol; i++){ struct symbol *sp = lemp->symbols[i]; 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++; } } for(i=0; i<lemp->nsymbol && lemp->symbols[i]->type!=TERMINAL; i++); if( i<lemp->nsymbol ){ emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); fprintf(out," break;\n"); lineno++; } } if( lemp->vardest ){ struct symbol *dflt_sp = 0; int once = 1; for(i=0; i<lemp->nsymbol; i++){ struct symbol *sp = lemp->symbols[i]; if( sp==0 || sp->type==TERMINAL || 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++; } dflt_sp = sp; } if( dflt_sp!=0 ){ emit_destructor_code(out,dflt_sp,lemp,&lineno); } fprintf(out," break;\n"); lineno++; } for(i=0; i<lemp->nsymbol; i++){ struct symbol *sp = lemp->symbols[i]; if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; /* Combine duplicate destructors into a single case */ for(j=i+1; j<lemp->nsymbol; j++){ struct symbol *sp2 = lemp->symbols[j]; if( sp2 && sp2->type!=TERMINAL && sp2->destructor && sp2->dtnum==sp->dtnum && strcmp(sp->destructor,sp2->destructor)==0 ){ |
︙ | ︙ |