From df3bf6ba47b9d28c8f3facc2b586f03fdcb938b7 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Sat, 23 Sep 2006 23:08:22 +0000 Subject: [PATCH] Add an explicit "%prec QUESTIONMARK" for the ternary conditional operator to fix all the shift/reduce conflicts which adding it created. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9338 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/CParse/parser.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SWIG/Source/CParse/parser.y b/SWIG/Source/CParse/parser.y index c851e228d..b5f76b9f4 100644 --- a/SWIG/Source/CParse/parser.y +++ b/SWIG/Source/CParse/parser.y @@ -5429,7 +5429,7 @@ exprcompound : expr PLUS expr { $$.val = NewStringf("%s!=%s",$1.val,$3.val); $$.type = T_INT; } -/* +/* Sadly this causes 2 reduce-reduce conflicts with templates. FIXME resolve these. | expr GREATERTHAN expr { $$.val = NewStringf("%s>%s",$1.val,$3.val); $$.type = T_INT; @@ -5447,7 +5447,7 @@ exprcompound : expr PLUS expr { $$.val = NewStringf("%s<=%s",$1.val,$3.val); $$.type = T_INT; } - | expr QUESTIONMARK expr COLON expr { + | expr QUESTIONMARK expr COLON expr %prec QUESTIONMARK { $$.val = NewStringf("%s?%s:%s", $1.val, $3.val, $5.val); /* This may not be exactly right, but is probably good enough * for the purposes of parsing constant expressions. */