Added the MPExpressionTree Classes
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
//
|
||||
|
||||
#import "MPParenthesisFunction.h"
|
||||
#import "MPExpressionEvaluator.h"
|
||||
|
||||
@implementation MPParenthesisFunction
|
||||
|
||||
@@ -19,11 +18,14 @@ MPFunctionAccessorImplementation(Expression, _expression)
|
||||
return @[@"expression"];
|
||||
}
|
||||
|
||||
- (MPTerm *)parseWithError:(MPParseError *__autoreleasing *)error
|
||||
- (BOOL)validate:(MPParseError *__autoreleasing *)error
|
||||
{
|
||||
MPExpressionEvaluator *evaluator = [[MPExpressionEvaluator alloc] initWithExpression:self.expression];
|
||||
return [evaluator parseExpectingVariable:NO
|
||||
error:error];
|
||||
return [[self.expression parse] validate:error];
|
||||
}
|
||||
|
||||
- (NSDecimalNumber *)evaluate
|
||||
{
|
||||
return [[self.expression parse] evaluate];
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
|
||||
Reference in New Issue
Block a user