- /* Shift-reduce conflict occurs for token number i
- and it has a precedence.
- The precedence of shifting is that of token i. */
- if (symbols[i]->prec < redprec)
- {
- log_resolution (redrule, i, reduce_resolution);
- flush_shift (s, i);
- }
- else if (symbols[i]->prec > redprec)
- {
- log_resolution (redrule, i, shift_resolution);
- flush_reduce (lookahead_tokens, i);
- }
- else
- /* Matching precedence levels.
- For left association, keep only the reduction.
- For right association, keep only the shift.
- For nonassociation, keep neither. */
-
- switch (symbols[i]->assoc)
- {
- default:
- abort ();
-
- case right_assoc:
- log_resolution (redrule, i, right_resolution);
- flush_reduce (lookahead_tokens, i);
- break;
-
- case left_assoc:
- log_resolution (redrule, i, left_resolution);
- flush_shift (s, i);
- break;
-
- case non_assoc:
- log_resolution (redrule, i, nonassoc_resolution);
- flush_shift (s, i);
- flush_reduce (lookahead_tokens, i);
- /* Record an explicit error for this token. */
- errors[(*nerrs)++] = symbols[i];
- break;
- }
+ /* Shift-reduce conflict occurs for token number i
+ and it has a precedence.
+ The precedence of shifting is that of token i. */
+ if (symbols[i]->prec < redprec)
+ {
+ log_resolution (redrule, i, reduce_resolution);
+ flush_shift (s, i);
+ }
+ else if (symbols[i]->prec > redprec)
+ {
+ log_resolution (redrule, i, shift_resolution);
+ flush_reduce (lookahead_tokens, i);
+ }
+ else
+ /* Matching precedence levels.
+ For non-defined associativity, keep both: unexpected
+ associativity conflict.
+ For left associativity, keep only the reduction.
+ For right associativity, keep only the shift.
+ For nonassociativity, keep neither. */
+
+ switch (symbols[i]->assoc)
+ {
+ case undef_assoc:
+ abort ();
+
+ case precedence_assoc:
+ break;
+
+ case right_assoc:
+ log_resolution (redrule, i, right_resolution);
+ flush_reduce (lookahead_tokens, i);
+ break;
+
+ case left_assoc:
+ log_resolution (redrule, i, left_resolution);
+ flush_shift (s, i);
+ break;
+
+ case non_assoc:
+ log_resolution (redrule, i, nonassoc_resolution);
+ flush_shift (s, i);
+ flush_reduce (lookahead_tokens, i);
+ /* Record an explicit error for this token. */
+ errors[(*nerrs)++] = symbols[i];
+ break;
+ }