Author Topic: Can't have a symbol coloring rule specify both Private and Protected scope  (Read 2670 times)

evanratt

  • Senior Community Member
  • Posts: 300
  • Hero Points: 23
Messing around with symbol coloring and I've come across this small bug. I'm trying to make a rule for C++ that shows private and protected functions in italics. I'm using this code as my test case:

Code: [Select]
class Foo {
private:
void baz() {
0;
}
protected:
void bar() {
1;
}
public:
void goober() {
baz();
bar();
}
};

If my rule is "func, proto: Private scope", then baz() is displayed in italics. If my rule is "func, proto: Protected scope", then bar() is displayed in italics. However, if my rule is "func, proto: Protected scope, Private scope", then neither baz() nor bar() are displayed in italics.

-Evan

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4480
  • Hero Points: 344
The private and protected flags are doing an AND.  You need two separate rules.  One for private and one for protected.

evanratt

  • Senior Community Member
  • Posts: 300
  • Hero Points: 23
Ah, gotcha. Thanks... So the Attributes are ANDed together, but the Types are ORed together?

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2500
  • Hero Points: 364
Yes, attributes are AND'd.  Types are inclusive.

Note that attributes are 3-state, so you could create a rule for Private and Protected by creating a rule that specified false for Public and Package scope.  However, I would recommend using two rules, just because it's a lot simpler that way.

Also, if you have any questions about what the different types or attributes mean, the documentation is there now and very thoroughly describes each and every type and attribute, as well as the standard rules and coloring choices that were made.

evanratt

  • Senior Community Member
  • Posts: 300
  • Hero Points: 23
After I made my previous post I did find the documentation and really do want to commend you guys on it. It does a great job of explaining each of the types and attributes, and the section describing the included schemes is a very helpful bonus - great!