Skip to content

Commit

Permalink
fix @tokens, again
Browse files Browse the repository at this point in the history
  • Loading branch information
ksherlock committed Jan 31, 2016
1 parent eb02ef0 commit ff6e28b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -3579,14 +3579,16 @@ PRIVATE void translate_code(struct lemon *lemp, struct rule *rp){
}
}
/* also generate major tokens -- if @ in code.*/
if (strchr(rp->code, '@')) for(i=0; i<rp->nrhs; i++){
if (rp->rhsalias[i]) {
if (strchr(rp->code, '@')) {
for(i=0; i<rp->nrhs; i++){
if (rp->rhsalias[i]) {

append_str("const int yymsp_%d_major", 0, i, 0);
append_str(" = yymsp[%d].major;", 0 ,i-rp->nrhs+1, 0);
append_str(" /* @", 0, 0, 0);
append_str(rp->rhsalias[i], 0, 0, 0);
append_str(" */\n", 0, 0, 0);
append_str("const int yymsp_%d_major", 0, i, 0);
append_str(" = yymsp[%d].major;", 0 ,i-rp->nrhs+1, 0);
append_str(" /* @", 0, 0, 0);
append_str(rp->rhsalias[i], 0, 0, 0);
append_str(" */\n", 0, 0, 0);
}
}

/* and prevent unused variable warnings... */
Expand Down

0 comments on commit ff6e28b

Please sign in to comment.