aboutsummaryrefslogtreecommitdiff
path: root/tool/lemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'tool/lemon.c')
-rw-r--r--tool/lemon.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tool/lemon.c b/tool/lemon.c
index df758a5da..0fa3d63b4 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -263,7 +263,8 @@ struct symbol {
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 */
+ int destLineno; /* Line number for start of destructor. Set to
+ ** -1 for duplicate destructors. */
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
@@ -4385,6 +4386,7 @@ void ReportTable(
for(i=0; i<lemp->nsymbol; i++){
struct symbol *sp = lemp->symbols[i];
if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue;
+ if( sp->destLineno<0 ) continue; /* Already emitted */
fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++;
/* Combine duplicate destructors into a single case */
@@ -4395,7 +4397,7 @@ void ReportTable(
&& strcmp(sp->destructor,sp2->destructor)==0 ){
fprintf(out," case %d: /* %s */\n",
sp2->index, sp2->name); lineno++;
- sp2->destructor = 0;
+ sp2->destLineno = -1; /* Avoid emitting this destructor again */
}
}