- mask = 1;
- fp1 = LA + lookaheadnum * tokensetsize;
- fp2 = lookaheadset;
- for (i = 0; i < ntokens; i++)
- {
- if ((mask & *fp2 & *fp1) && sprec[i])
- /* Shift-reduce conflict occurs for token number i
- and it has a precedence.
- The precedence of shifting is that of token i. */
- {
- if (sprec[i] < redprec)
- {
- if (verboseflag) log_resolution(state, lookaheadnum, i, _("reduce"));
- *fp2 &= ~mask; /* flush the shift for this token */
- flush_shift(state, i);
- }
- else if (sprec[i] > redprec)
- {
- if (verboseflag) log_resolution(state, lookaheadnum, i, _("shift"));
- *fp1 &= ~mask; /* flush the reduce for this token */
- }
- else
- {
- /* Matching precedence levels.
- For left association, keep only the reduction.
- For right association, keep only the shift.
- For nonassociation, keep neither. */
-
- switch (sassoc[i])
- {
-
- case RIGHT_ASSOC:
- if (verboseflag) log_resolution(state, lookaheadnum, i, _("shift"));
- break;
-
- case LEFT_ASSOC:
- if (verboseflag) log_resolution(state, lookaheadnum, i, _("reduce"));
- break;
-
- case NON_ASSOC:
- if (verboseflag) log_resolution(state, lookaheadnum, i, _("an error"));
- break;
- }
-
- if (sassoc[i] != RIGHT_ASSOC)
- {
- *fp2 &= ~mask; /* flush the shift for this token */
- flush_shift(state, i);
- }
- if (sassoc[i] != LEFT_ASSOC)
- {
- *fp1 &= ~mask; /* flush the reduce for this token */
- }
- if (sassoc[i] == NON_ASSOC)
- {
- /* Record an explicit error for this token. */
- *errtokens++ = i;
- }
- }
- }
-
- mask <<= 1;
- if (mask == 0)
- {
- mask = 1;
- fp2++; fp1++;
- }
- }
- errp->nerrs = errtokens - errp->errs;
- if (errp->nerrs)