mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-01-31 18:50:33 +00:00
Lemon update 2016-04-29 11:28:35 on branch trunk
— Lemon bug fix: Do not merge action routines unless their destructors are also identical. Problem and suggested fix reported on the mailing list by Kelvin Sherlock. (user: drh)
This commit is contained in:
parent
de56be6c01
commit
45d441f103
1 changed files with 15 additions and 6 deletions
|
@ -3559,10 +3559,7 @@ PRIVATE int translate_code(struct lemon *lemp, struct rule *rp){
|
||||||
rp->line = rp->ruleline;
|
rp->line = rp->ruleline;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( rp->lhsalias==0 ){
|
if( rp->nrhs==0 ){
|
||||||
/* There is no LHS value symbol. */
|
|
||||||
lhsdirect = 1;
|
|
||||||
}else if( rp->nrhs==0 ){
|
|
||||||
/* If there are no RHS symbols, then writing directly to the LHS is ok */
|
/* If there are no RHS symbols, then writing directly to the LHS is ok */
|
||||||
lhsdirect = 1;
|
lhsdirect = 1;
|
||||||
}else if( rp->rhsalias[0]==0 ){
|
}else if( rp->rhsalias[0]==0 ){
|
||||||
|
@ -3575,6 +3572,9 @@ PRIVATE int translate_code(struct lemon *lemp, struct rule *rp){
|
||||||
rp->rhs[0]->index,1-rp->nrhs,0);
|
rp->rhs[0]->index,1-rp->nrhs,0);
|
||||||
rp->codePrefix = Strsafe(append_str(0,0,0,0,0));
|
rp->codePrefix = Strsafe(append_str(0,0,0,0,0));
|
||||||
}
|
}
|
||||||
|
}else if( rp->lhsalias==0 ){
|
||||||
|
/* There is no LHS value symbol. */
|
||||||
|
lhsdirect = 1;
|
||||||
}else if( strcmp(rp->lhsalias,rp->rhsalias[0])==0 ){
|
}else if( strcmp(rp->lhsalias,rp->rhsalias[0])==0 ){
|
||||||
/* The LHS symbol and the left-most RHS symbol are the same, so
|
/* The LHS symbol and the left-most RHS symbol are the same, so
|
||||||
** direct writing is allowed */
|
** direct writing is allowed */
|
||||||
|
@ -3717,7 +3717,7 @@ PRIVATE int translate_code(struct lemon *lemp, struct rule *rp){
|
||||||
|
|
||||||
/* Suffix code generation complete */
|
/* Suffix code generation complete */
|
||||||
cp = append_str(0,0,0,0,0);
|
cp = append_str(0,0,0,0,0);
|
||||||
if( cp ) rp->codeSuffix = Strsafe(cp);
|
if( cp && cp[0] ) rp->codeSuffix = Strsafe(cp);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -4399,7 +4399,14 @@ void ReportTable(
|
||||||
for(rp=lemp->rule; rp; rp=rp->next){
|
for(rp=lemp->rule; rp; rp=rp->next){
|
||||||
struct rule *rp2; /* Other rules with the same action */
|
struct rule *rp2; /* Other rules with the same action */
|
||||||
if( rp->code==0 ) continue;
|
if( rp->code==0 ) continue;
|
||||||
if( rp->code[0]=='\n' && rp->code[1]==0 ) continue; /* Will be default: */
|
if( rp->code[0]=='\n'
|
||||||
|
&& rp->code[1]==0
|
||||||
|
&& rp->codePrefix==0
|
||||||
|
&& rp->codeSuffix==0
|
||||||
|
){
|
||||||
|
/* No actions, so this will be part of the "default:" rule */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
fprintf(out," case %d: /* ",rp->iRule);
|
fprintf(out," case %d: /* ",rp->iRule);
|
||||||
writeRuleText(out, rp);
|
writeRuleText(out, rp);
|
||||||
fprintf(out," */\n"); lineno++;
|
fprintf(out," */\n"); lineno++;
|
||||||
|
@ -4422,6 +4429,8 @@ void ReportTable(
|
||||||
for(rp=lemp->rule; rp; rp=rp->next){
|
for(rp=lemp->rule; rp; rp=rp->next){
|
||||||
if( rp->code==0 ) continue;
|
if( rp->code==0 ) continue;
|
||||||
assert( rp->code[0]=='\n' && rp->code[1]==0 );
|
assert( rp->code[0]=='\n' && rp->code[1]==0 );
|
||||||
|
assert( rp->codePrefix==0 );
|
||||||
|
assert( rp->codeSuffix==0 );
|
||||||
fprintf(out," /* (%d) ", rp->iRule);
|
fprintf(out," /* (%d) ", rp->iRule);
|
||||||
writeRuleText(out, rp);
|
writeRuleText(out, rp);
|
||||||
fprintf(out," */ yytestcase(yyruleno==%d);\n", rp->iRule); lineno++;
|
fprintf(out," */ yytestcase(yyruleno==%d);\n", rp->iRule); lineno++;
|
||||||
|
|
Loading…
Reference in a new issue