-C In\sLemon,\sif\sa\snon-terminal\shas\sthe\ssame\stype\sas\sa\sterminal,\sthen\sreuse\sthe\nterminal\stype\sin\sthe\sYYMINORTYPE\sunion\sfor\sthe\snon-terminal.\s\sThis\sgives\nbetter\stable\scompression.\s(CVS\s5334)
-D 2008-07-01T16:34:50
+C In\slemon:\scoalesce\sidentical\sdestructors.\s(CVS\s5335)
+D 2008-07-01T17:13:57
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 325dfac0a0dd1cb4d975f1ace6453157892e6042
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F test/zeroblob.test 792124852ec61458a2eb527b5091791215e0be95
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
-F tool/lemon.c b7ea2ab73efcae17de678e27311e3a6fb45b9916
+F tool/lemon.c f1f54e93808b09d2000ec1c3ff53888a27067b52
F tool/lempar.c aab54f1758c554e550ff5c4b191053a819279a2b
F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133
F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 6ee71f4ddb4fa934f58c87dad2d30560af2e55d7
-R abb51076ff7832ca4d7b7efbfab1e246
+P 5c9cc22cd8e9bec3d8622d2c354423281f2db0fb
+R 572c6d45547d9cace3b11f3c52551913
U drh
-Z 25821389214193632a5f6ed1eb5ed459
+Z d8dbcd09b221a01c995fcf2ef0061da2
int useCnt; /* Number of times used */
char *destructor; /* Code which executes whenever this symbol is
** popped from the stack during error processing */
+ int destLineno; /* Line number for start of destructor */
char *datatype; /* The data type of information held by this
** object. Only used if type==NONTERMINAL */
int dtnum; /* The data type number. In the parser, the value
char *declkeyword; /* Keyword of a declaration */
char **declargslot; /* Where the declaration argument should be put */
int insertLineMacro; /* Add #line before declaration insert */
+ int *decllinenoslot; /* Where to write declaration line number */
enum e_assoc declassoc; /* Assign this association to decl arguments */
int preccounter; /* Assign this precedence to decl arguments */
struct rule *firstrule; /* Pointer to first rule in the grammar */
if( isalpha(x[0]) ){
psp->declkeyword = x;
psp->declargslot = 0;
+ psp->decllinenoslot = 0;
psp->insertLineMacro = 1;
psp->state = WAITING_FOR_DECL_ARG;
if( strcmp(x,"name")==0 ){
}else{
struct symbol *sp = Symbol_new(x);
psp->declargslot = &sp->destructor;
+ psp->decllinenoslot = &sp->destLineno;
psp->insertLineMacro = 1;
psp->state = WAITING_FOR_DECL_ARG;
}
}
nOld = strlen(zOld);
n = nOld + nNew + 20;
- if( psp->insertLineMacro ){
+ if( psp->insertLineMacro && psp->decllinenoslot
+ && psp->decllinenoslot[0] ){
for(z=psp->filename, nBack=0; *z; z++){
if( *z=='\\' ) nBack++;
}
}
*psp->declargslot = zBuf = realloc(*psp->declargslot, n);
zBuf += nOld;
- if( psp->insertLineMacro ){
+ if( psp->insertLineMacro && psp->decllinenoslot
+ && psp->decllinenoslot[0] ){
if( nOld && zBuf[-1]!='\n' ){
*(zBuf++) = '\n';
}
*(zBuf++) = '"';
*(zBuf++) = '\n';
}
+ if( psp->decllinenoslot && psp->decllinenoslot[0]==0 ){
+ psp->decllinenoslot[0] = psp->tokenlineno;
+ }
memcpy(zBuf, zNew, nNew);
zBuf += nNew;
*zBuf = 0;
}else if( sp->destructor ){
cp = sp->destructor;
fprintf(out,"{\n"); (*lineno)++;
+ tplt_linedir(out,sp->destLineno,lemp->outname); (*lineno)++;
}else if( lemp->vardest ){
cp = lemp->vardest;
if( cp==0 ) return;
** (In other words, generate the %destructor actions)
*/
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;
+ }
fprintf(out," case %d: /* %s */\n",
sp->index, sp->name); 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++;
+ once = 0;
+ }
fprintf(out," case %d: /* %s */\n",
sp->index, sp->name); lineno++;
dflt_sp = sp;
}
if( dflt_sp!=0 ){
emit_destructor_code(out,dflt_sp,lemp,&lineno);
- fprintf(out," break;\n"); lineno++;
}
+ fprintf(out," break;\n"); lineno++;
}
for(i=0; i<lemp->nsymbol; i++){
struct symbol *sp = lemp->symbols[i];
sp->firstset = 0;
sp->lambda = LEMON_FALSE;
sp->destructor = 0;
+ sp->destLineno = 0;
sp->datatype = 0;
sp->useCnt = 0;
Symbol_insert(sp,sp->name);