Skip to content

Commit

Permalink
shift-reduces may be optimized to simply a reduce.
Browse files Browse the repository at this point in the history
error non-terminals should not be optimized to a reduce since the shift needs to happen.
  • Loading branch information
ksherlock committed Dec 31, 2018
1 parent b11e73d commit 776197a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -3498,7 +3498,7 @@ PRIVATE int compute_action(struct lemon *lemp, struct action *ap)
/* Since a SHIFT is inherient after a prior REDUCE, convert any
** SHIFTREDUCE action with a nonterminal on the LHS into a simple
** REDUCE action: */
if( ap->sp->index>=lemp->nterminal ){
if( ap->sp->index>=lemp->nterminal && ap->sp!=lemp->errsym ){
act = lemp->minReduce + ap->x.rp->iRule;
}else{
act = lemp->minShiftReduce + ap->x.rp->iRule;
Expand Down

0 comments on commit 776197a

Please sign in to comment.