Fix a major leakage of token minors in lemon generated parsers due to the fact that lemon was not genmerating destructor code for elements in the RHS of rules without C-code.

svn path=/trunk/; revision=20442
This commit is contained in:
Luis Ontanon 2007-01-15 19:48:06 +00:00
parent 4ea1d12df8
commit 47730bc1e8
1 changed files with 3 additions and 1 deletions

View File

@ -3245,6 +3245,8 @@ PRIVATE void translate_code(struct lemon *lemp, struct rule *rp){
for(i=0; i<rp->nrhs; i++) used[i] = 0;
lhsused = 0;
if (! rp->code) rp->code = "\n";
append_str(0,0,0,0);
for(cp=rp->code; *cp; cp++){
if( safe_isalpha(*cp) && (cp==rp->code || (!safe_isalnum(cp[-1]) && cp[-1]!='_')) ){
@ -3875,7 +3877,7 @@ void ReportTable(
/* Generate code which execution during each REDUCE action */
for(rp=lemp->rule; rp; rp=rp->next){
if( rp->code ) translate_code(lemp, rp);
translate_code(lemp, rp);
}
for(rp=lemp->rule; rp; rp=rp->next){
struct rule *rp2;