Archived
1

Added the MPExpressionTree Classes

This commit is contained in:
Kim Wittenburg
2014-10-13 23:53:04 +02:00
parent 82259f87e2
commit 5592128926
60 changed files with 1981 additions and 725 deletions

View File

@@ -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