aboutsummaryrefslogtreecommitdiff
path: root/tool/lemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'tool/lemon.c')
-rw-r--r--tool/lemon.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/tool/lemon.c b/tool/lemon.c
index f05e9e6ce..8946f1455 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -2285,11 +2285,21 @@ to follow the previous rule.");
psp->errorcnt++;
psp->state = RESYNC_AFTER_DECL_ERROR;
}else{
- struct symbol *sp = Symbol_new(x);
- psp->declargslot = &sp->destructor;
- psp->decllinenoslot = &sp->destLineno;
- psp->insertLineMacro = 1;
- psp->state = WAITING_FOR_DECL_ARG;
+ struct symbol *sp = Symbol_find(x);
+ if((sp) && (sp->datatype)){
+ ErrorMsg(psp->filename,psp->tokenlineno,
+ "Symbol %%destructor \"%s\" already defined", x);
+ psp->errorcnt++;
+ psp->state = RESYNC_AFTER_DECL_ERROR;
+ }else{
+ if (!sp){
+ sp = Symbol_new(x);
+ }
+ psp->declargslot = &sp->destructor;
+ psp->decllinenoslot = &sp->destLineno;
+ psp->insertLineMacro = 1;
+ psp->state = WAITING_FOR_DECL_ARG;
+ }
}
break;
case WAITING_FOR_DATATYPE_SYMBOL: