Archived
1

Model Redesign: Added Reference Frames

Added Inverse Functions
UI Redesign
Cleaned Code
This commit is contained in:
Kim Wittenburg
2014-10-07 20:25:54 +02:00
parent 8f2f773909
commit 82259f87e2
40 changed files with 1124 additions and 998 deletions

View File

@@ -9,7 +9,6 @@
#import "MPTokenStream.h"
@implementation MPTokenStream {
NSUInteger currentTokenIndex;
NSUInteger eofLocation;
}
@@ -32,37 +31,34 @@
if (!self.isIgnoringWhitespaceTokens) {
return;
}
while (currentTokenIndex < self.tokens.count) {
MPToken *token = self.tokens[currentTokenIndex];
while (self.currentTokenIndex < self.tokens.count) {
MPToken *token = self.tokens[self.currentTokenIndex];
if (token.tokenType != MPWhitespaceToken) {
return;
}
self.currentLocation = NSMaxRange(token.range);
++currentTokenIndex;
++self.currentTokenIndex;
}
}
- (void)reset
{
currentTokenIndex = 0;
self.currentLocation = 0;
self.currentTokenIndex = 0;
[self skipWhitespaces];
}
- (BOOL)hasMoreTokens
{
[self skipWhitespaces];
return currentTokenIndex < self.tokens.count;
return self.currentTokenIndex < self.tokens.count;
}
- (MPToken *)nextToken
{
[self skipWhitespaces];
if (currentTokenIndex >= self.tokens.count) {
if (self.currentTokenIndex >= self.tokens.count) {
return [[MPToken alloc] initEOFTokenAtLocation:eofLocation];
} else {
MPToken *token = self.tokens[currentTokenIndex++];
self.currentLocation = NSMaxRange(token.range);
MPToken *token = self.tokens[self.currentTokenIndex++];
return token;
}
}
@@ -70,15 +66,14 @@
- (MPToken *)nextTokenOfType:(MPTokenType)type
{
[self skipWhitespaces];
if (currentTokenIndex >= self.tokens.count) {
if (self.currentTokenIndex >= self.tokens.count) {
return nil;
} else {
MPToken *token = self.tokens[currentTokenIndex];
MPToken *token = self.tokens[self.currentTokenIndex];
if (token.tokenType != type) {
return nil;
}
++currentTokenIndex;
self.currentLocation = NSMaxRange(token.range);
++self.currentTokenIndex;
return token;
}
}