Cleaned Code by Removing Location Tracking for Errors
This commit is contained in:
@@ -8,9 +8,7 @@
|
||||
|
||||
#import "MPOperatorChain.h"
|
||||
|
||||
@implementation MPOperatorChain {
|
||||
NSRange _range;
|
||||
}
|
||||
@implementation MPOperatorChain
|
||||
|
||||
- (id)init
|
||||
{
|
||||
@@ -26,11 +24,12 @@
|
||||
if (self) {
|
||||
[tokenStream beginIgnoringWhitespaceTokens];
|
||||
MPToken *currentToken = tokenStream.currentToken;
|
||||
|
||||
if (currentToken.tokenType != MPOperatorListToken) {
|
||||
@throw [NSException exceptionWithName:NSInternalInconsistencyException reason:@"Expected Operators" userInfo:nil];
|
||||
}
|
||||
|
||||
NSString *operatorString = currentToken.stringValue;
|
||||
_range = currentToken.range;
|
||||
operatorString = [[operatorString componentsSeparatedByString:@" "] componentsJoinedByString:@""];
|
||||
_negating = NO;
|
||||
_numberOfOperators = operatorString.length;
|
||||
@@ -39,18 +38,14 @@
|
||||
_negating = !_negating;
|
||||
}
|
||||
}
|
||||
|
||||
[tokenStream currentTokenConsumed];
|
||||
[tokenStream endIgnoringOrAcceptingWhitespaceTokens];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSRange)range
|
||||
{
|
||||
return _range;
|
||||
}
|
||||
|
||||
- (BOOL)validate:(MPParseError *__autoreleasing *)error
|
||||
- (BOOL)validate:(NSError *__autoreleasing *)error
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
@@ -60,16 +55,4 @@
|
||||
return self.negating ? [[NSDecimalNumber alloc] initWithInteger:-1] : [NSDecimalNumber one];
|
||||
}
|
||||
|
||||
- (NSArray *)expressionElements
|
||||
{
|
||||
NSMutableString *text = [[NSMutableString alloc] init];
|
||||
for (NSUInteger index = 1; index < self.numberOfOperators; index++) {
|
||||
[text appendString:@"+"];
|
||||
}
|
||||
if (self.negating) {
|
||||
[text appendString:@"-"];
|
||||
}
|
||||
return @[text.copy];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user