Skip to content

Commit

Permalink
Lemon fix: don't let grammar define the same nonterminal %type more t…
Browse files Browse the repository at this point in the history
…han once.
  • Loading branch information
icculus committed Feb 17, 2010
1 parent 3d53100 commit 0a1ed1b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions misc/lemon.c
Expand Up @@ -2357,10 +2357,20 @@ to follow the previous rule.");
psp->errorcnt++;
psp->state = RESYNC_AFTER_DECL_ERROR;
}else{
struct symbol *sp = Symbol_new(x);
psp->declargslot = &sp->datatype;
psp->insertLineMacro = 0;
psp->state = WAITING_FOR_DECL_ARG;
struct symbol *sp = Symbol_find(x);
if((sp) && (sp->datatype)){
ErrorMsg(psp->filename,psp->tokenlineno,
"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;
case WAITING_FOR_PRECEDENCE_SYMBOL:
Expand Down

0 comments on commit 0a1ed1b

Please sign in to comment.