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
This commit is contained in:
Olly Betts 2006-09-23 23:08:22 +00:00
commit df3bf6ba47

View file

@ -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. */