public class ERXBooleanExpressionParser
extends Object
Parses a boolean expression and evaluates that boolean expression against a valueProvider object that returns boolean values
for the variable symbols found in the boolean expression.
The valueProvider object must implement NSKeyValueCodingAdditions interface.
Acceptable boolean expressions can use the words AND, OR and NOT in upper, lower or mixed case. Parentheses can be
used as needed to group elements of the expression.
Variable symbols in the boolean expression can use characters and formatting of typical keys or keyPaths.
All other words besides AND, OR and NOT are assumed to be variables (aka keyPaths) which resolve to Boolean values when
valueForKeyPath is invoked on the valueProvider object (which can be a NSDictionary of variable values or any object that
implements NSKeyValueCodingAdditions
)
For example
Expression: (canViewPerson AND canEditPerson) OR (isTheBoss AND NOT account.isAccountDisabled)
- Author:
- kieran