From 5c1231d2dfc90258fd3c7eb42717dd7fa7d22393 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Tue, 4 Jan 2005 20:34:05 +0000 Subject: [PATCH] Add the precedence of the conditional operator. --- tools/widl/parser.y | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 6448d8f520d..55c78620dd3 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -205,6 +205,7 @@ static type_t std_uhyper = { "MIDL_uhyper" }; %type libraryhdr %left ',' +%right COND %left '|' %left '&' %left '-' '+' @@ -460,7 +461,7 @@ m_expr: { $$ = make_expr(EXPR_VOID); } expr: aNUM { $$ = make_exprl(EXPR_NUM, $1); } | aHEXNUM { $$ = make_exprl(EXPR_HEXNUM, $1); } | aIDENTIFIER { $$ = make_exprs(EXPR_IDENTIFIER, $1); } - | expr '?' expr ':' expr { $$ = make_expr3(EXPR_COND, $1, $3, $5); } + | expr '?' expr ':' expr %prec COND { $$ = make_expr3(EXPR_COND, $1, $3, $5); } | expr '|' expr { $$ = make_expr2(EXPR_OR , $1, $3); } | expr '&' expr { $$ = make_expr2(EXPR_AND, $1, $3); } | expr '+' expr { $$ = make_expr2(EXPR_ADD, $1, $3); }