Archived
1

Added the MPExpressionTree Classes

This commit is contained in:
Kim Wittenburg
2014-10-13 23:53:04 +02:00
parent 82259f87e2
commit 5592128926
60 changed files with 1981 additions and 725 deletions

View File

@@ -15,6 +15,9 @@ typedef NS_ENUM(NSUInteger, MPTokenType) {
MPSinToken,
MPCosToken,
MPTanToken,
MPASinToken,
MPACosToken,
MPATanToken,
MPNumberToken,
MPVariableToken,
MPFactorialToken,
@@ -23,11 +26,8 @@ typedef NS_ENUM(NSUInteger, MPTokenType) {
MPWhitespaceToken,
MPUnidentifiedToken,
MPCompoundToken
};
@protocol MPToken <NSObject>
- (MPTokenType)tokenType;
@@ -41,22 +41,8 @@ typedef NS_ENUM(NSUInteger, MPTokenType) {
@interface MPToken : NSObject <MPToken>
- (instancetype)initEOFTokenAtLocation:(NSUInteger)eofLocation;
- (instancetype)initWithRange:(NSRange)range
stringValue:(NSString *)input;
- (instancetype)initWithTokenType:(MPTokenType)tokenType
range:(NSRange)range
stringValue:(NSString *)input;
@end
@interface MPToken (MPTokenExtension)
// Methods are only available for respective token type
- (NSUInteger)numberOfOperators;
- (NSDecimalNumber *)operatorValue;
- (NSDecimalNumber *)number;
- (NSString *)variable;
@end