Added Evaluation Context and Math Rules
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#import "MPFunction.h"
|
||||
#import "MPParsedFactor.h"
|
||||
#import "MPFunction+MPParsedFactor.h"
|
||||
#import "MPMathRules.h"
|
||||
|
||||
@interface MPExpressionEvaluator ()
|
||||
@property (readwrite, nonatomic, strong) NSString *definedVariable;
|
||||
@@ -87,8 +88,12 @@
|
||||
} else {
|
||||
if (!currentProduct) {
|
||||
currentProduct = [[MPParsedProduct alloc] init];
|
||||
} else if ([MPMathRules sharedRules].allowsImplicitMultiplication) {
|
||||
[currentProduct addFactor:(MPFunction *)element];
|
||||
} else {
|
||||
*error = MPParseError(NSMakeRange(((MPFunction *)element).range.location, 0), @"Implicit Multiplication not allowed");
|
||||
return nil;
|
||||
}
|
||||
[currentProduct addFactor:(MPFunction *)element];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user