+ # Classify operators into binary, unary, or
+ # definitions (* only) where they have more
+ # than one mode.
+ my $unary_ctx = $prevline . $ca;
+ $unary_ctx =~ s/^./ /;
+ my $is_unary = 0;
+ my $Unary = qr{
+ (?:
+ ^|;|,|$ops|\(|\?|:|
+ \(\s*$Type\s*\)|
+ $Type|
+ return|case|else|
+ \{|\}|
+ \[|
+ ^.\#\s*define\s+$Ident\s*(?:\([^\)]*\))?|
+ ^.\#\s*else|
+ ^.\#\s*endif|
+ ^.\#\s*(?:if|ifndef|ifdef)\b.*
+ )\s*(?:|\\)\s*$
+ }x;
+ my $UnaryFalse = qr{
+ sizeof\s*\(\s*$Type\s*\)\s*$
+ }x;
+ my $UnaryDefine = qr{
+ (?:$Type|$Bare)\s*|
+ (?:$Type|$Bare).*,\s*\**
+ }x;
+ if ($op eq '-' || $op eq '&' || $op eq '*') {
+ # An operator is binary if the left hand
+ # side is a value. Pick out the known
+ # non-values.
+ if ($unary_ctx =~ /$Unary$/s &&
+ $unary_ctx !~ /$UnaryFalse$/s) {
+ $is_unary = 1;
+
+ # Special handling for ')' check if this
+ # brace represents a conditional, if so
+ # we are unary.
+ } elsif ($unary_ctx =~ /\)\s*$/) {
+ my $before = ctx_expr_before($unary_ctx);
+ if ($before =~ /(?:for|if|while)\s*$/) {
+ $is_unary = 1;
+ }
+ }
+
+ # Check for type definition for of '*'.
+ if ($op eq '*' && $unary_ctx =~ /$UnaryDefine$/) {
+ $is_unary = 2;
+ }
+ }
+
+ #if ($op eq '-' || $op eq '&' || $op eq '*') {
+ # print "UNARY: <$is_unary $a:$op:$c> <$ca:$op:$cc> <$unary_ctx>\n";
+ #}