Lemon update 2010-02-17 20:31:32 on branch lemon-update-2010

- Report error if the grammar has multiple %type lines for the same nonterminal.
This commit is contained in:
Randy Heit 2016-03-20 09:56:17 -05:00
parent 3d7a8e8348
commit 54ff482d8f

View file

@ -2291,10 +2291,20 @@ to follow the previous rule.");
psp->errorcnt++; psp->errorcnt++;
psp->state = RESYNC_AFTER_DECL_ERROR; psp->state = RESYNC_AFTER_DECL_ERROR;
}else{ }else{
struct symbol *sp = Symbol_new(x); struct symbol *sp = Symbol_find(x);
psp->declargslot = &sp->datatype; if((sp) && (sp->datatype)){
psp->insertLineMacro = 0; ErrorMsg(psp->filename,psp->tokenlineno,
psp->state = WAITING_FOR_DECL_ARG; "Symbol %%type \"%s\" already defined", x);
psp->errorcnt++;
psp->state = RESYNC_AFTER_DECL_ERROR;
}else{
if (!sp){
sp = Symbol_new(x);
}
psp->declargslot = &sp->datatype;
psp->insertLineMacro = 0;
psp->state = WAITING_FOR_DECL_ARG;
}
} }
break; break;
case WAITING_FOR_PRECEDENCE_SYMBOL: case WAITING_FOR_PRECEDENCE_SYMBOL: