The seven conflicts are related to "a ? b : c <op> d". In all the
cases we left the S/R conflict be resolved as a shift, i.e., "a ? b
: (c <op> d)". To make this explicit, give the rule of the ternary
operator a very low precedence. In fact give it the same precedence
as "?". Now, to resolve the conflict in "a ? b : c ? d : e" be parsed
as "a ? b : (c ? d : e)", make them right-associative.
* gettext-runtime/intl/plural.y: Require Bison 3.0, to use %precedence
instead of useless associativities such as %right.
Make '?' and ':' of the same precedence, right associative.
#endif
%}
+%require "3.0"
%parse-param {struct parse_args *arg}
%lex-param {struct parse_args *arg}
%define api.pure full
-%expect 7
+%expect 0
%union {
unsigned long int num;
There is no unary minus and no bitwise operators.
Operators with the same syntactic behaviour have been merged into a single
token, to save space in the array generated by bison. */
-%right '?' /* ? */
+%right '?' ':' /* ? */
%left '|' /* || */
%left '&' /* && */
%left EQUOP2 /* == != */
%left CMPOP2 /* < > <= >= */
%left ADDOP2 /* + - */
%left MULOP2 /* * / % */
-%right '!' /* ! */
+%precedence '!' /* ! */
%token <op> EQUOP2 CMPOP2 ADDOP2 MULOP2
%token <num> NUMBER