Archived
1
This repository has been archived on 2022-08-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
mathpad/MathPad/MPToken.h
Kim Wittenburg 82259f87e2 Model Redesign: Added Reference Frames
Added Inverse Functions
UI Redesign
Cleaned Code
2014-10-07 20:25:54 +02:00

62 lines
1.2 KiB
Objective-C

//
// MPToken.h
// MathPad
//
// Created by Kim Wittenburg on 19.09.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSUInteger, MPTokenType) {
MPEOFToken = 0,
MPMultiplicationSymbolToken,
MPOperatorListToken,
MPSinToken,
MPCosToken,
MPTanToken,
MPNumberToken,
MPVariableToken,
MPFactorialToken,
MPEqualsToken,
MPGenericFunctionToken,
MPWhitespaceToken,
MPUnidentifiedToken,
MPCompoundToken
};
@protocol MPToken <NSObject>
- (MPTokenType)tokenType;
- (NSRange)range;
- (NSString *)stringValue;
@end
@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