Archived
1

Cleaned Code by Removing Location Tracking for Errors

This commit is contained in:
Kim Wittenburg
2014-11-07 19:50:28 +01:00
parent 91e7dbe9f2
commit 139a75f816
59 changed files with 355 additions and 532 deletions

View File

@@ -28,7 +28,7 @@
[tokenStream beginIgnoringWhitespaceTokens];
MPToken *token = tokenStream.currentToken;
if (token.tokenType == MPVariableToken) {
self.variableName = token.stringValue;
_variableName = token.stringValue;
_range = token.range;
} else {
@throw [NSException exceptionWithName:NSInternalInconsistencyException reason:@"Expected Variable" userInfo:nil];
@@ -44,11 +44,13 @@
return _range;
}
- (BOOL)validate:(MPParseError *__autoreleasing *)error
- (BOOL)validate:(NSError *__autoreleasing *)error
{
if (![[MPEvaluationContext sharedContext] isVariableDefined:self.variableName]) {
if (error) {
*error = MPParseError(self.range, @"Undefined Variable");
*error = MPParseError(9,
NSLocalizedString(@"Undefined Variable.", @"Error message. This is displayed when an expression contains an undefined variable."),
nil);
}
return NO;
}
@@ -60,9 +62,4 @@
return [[MPEvaluationContext sharedContext] valueForVariable:self.variableName];
}
- (NSArray *)expressionElements
{
return @[self.variableName];
}
@end