Archived
1

Some small corrections

Added example expression (hardcoded for development)
Added example change for expressions (hardcoded for development)
This commit is contained in:
Kim Wittenburg
2014-05-18 01:10:50 +02:00
parent 982b70d7fb
commit 740c3fd80a
8 changed files with 72 additions and 11 deletions

View File

@@ -8,6 +8,8 @@
#import "MPExpressionStorage.h"
#import "MPExpressionLayout.h"
#import "MPFunctionLayout.h"
#import "MPRangePath.h"
@interface MPExpressionStorage ()
@property (nonatomic, strong) NSLayoutManager *layoutManager;
@@ -57,4 +59,24 @@
}
}
- (void)symbolsChangedInRangePath:(MPRangePath *)rangePath replacementLength:(NSUInteger)length
{
if (rangePath.location.length == 0) {
return;
}
id current = self.expressionLayout;
for (NSUInteger position = 1; position < rangePath.location.length-1; position++) {
if ([current isKindOfClass:[MPExpressionLayout class]]) {
current = [(MPExpressionLayout *)current functionLayoutForFunctionAtIndex:position];
} else {
current = [(MPFunctionLayout *)current expressionLayoutForChildAtIndex:position];
}
}
if ([current isKindOfClass:[MPExpressionLayout class]]) {
[(MPExpressionLayout *)current editedExpressionInRange:rangePath.rangeAtLastIndex replacementLength:length];
} else {
[(MPFunctionLayout *)current editedChildAtIndex:[rangePath.location indexAtPosition:rangePath.location.length-1]];
}
}
@end