Archived
1

Cleaned Imports

This commit is contained in:
Kim Wittenburg
2014-11-08 01:05:08 +01:00
parent 139a75f816
commit f4f924bd71
80 changed files with 237 additions and 164 deletions

View File

@@ -10,10 +10,38 @@
#import "MPExpressionElement.h"
#import "NSString+MPExpressionElement.h"
#import "MPFunction.h"
#import "MPSuffixFunction.h"
#import "MPSumFunction.h"
#import "MPParenthesisFunction.h"
#import "MPPowerFunction.h"
#import "MPFractionFunction.h"
#import "MPRootFunction.h"
#import "MPToken.h"
#import "MPFunction+MPToken.h"
#import "MPTokenStream.h"
#import "MPExpressionTreeElement.h"
#import "MPExpressionTree.h"
#import "MPSummand.h"
#import "MPOperatorChain.h"
#import "MPProduct.h"
#import "MPFactor.h"
#import "MPValueGroup.h"
#import "MPNumber.h"
#import "MPVariable.h"
#import "MPFunction+MPValue.h"
#import "MPFunctionValue.h"
#import "MPUnexpectedSymbolValue.h"
#import "MPFactorial.h"
#import "MPEvaluationContext.h"
#import "MPMathRules.h"
#import "MPRangePath.h"
#import "MPException.h"
#import "NSIndexPath+MPAdditions.h"
#import "NSRegularExpression+MPParsingAdditions.h"
#import "MPExpressionView.h"
#import "MPExpressionStorage.h"

View File

@@ -76,7 +76,6 @@
3B85833919BB63C500D76A8D /* MPExpressionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BFAC3961997B67400B3EF67 /* MPExpressionElement.h */; settings = {ATTRIBUTES = (Public, ); }; };
3B85833A19BB63D400D76A8D /* MPFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B87E35E19009D5F00259938 /* MPFunction.h */; settings = {ATTRIBUTES = (Public, ); }; };
3B85834119BB651E00D76A8D /* MPRangePath.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B87E35B1900933200259938 /* MPRangePath.h */; settings = {ATTRIBUTES = (Public, ); }; };
3B85834219BB652900D76A8D /* MPException.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B0F69A719028BC600817707 /* MPException.h */; settings = {ATTRIBUTES = (Public, ); }; };
3B85834319BB653700D76A8D /* MPSumFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BB09EC71906FD830080A5ED /* MPSumFunction.h */; settings = {ATTRIBUTES = (Public, ); }; };
3B85834419BB654D00D76A8D /* NSString+MPExpressionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BFAC39A1997BC7600B3EF67 /* NSString+MPExpressionElement.h */; settings = {ATTRIBUTES = (Public, ); }; };
3B85834519BB655200D76A8D /* NSIndexPath+MPAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BB09EDC190728220080A5ED /* NSIndexPath+MPAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -94,7 +93,6 @@
3BBEA93619BB79A700133766 /* MPFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B87E35F19009D5F00259938 /* MPFunction.m */; };
3BBEA93A19BB79A700133766 /* MPSumFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BB09EC81906FD830080A5ED /* MPSumFunction.m */; };
3BBEA93B19BB79A700133766 /* MPRangePath.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B87E35C1900933200259938 /* MPRangePath.m */; };
3BBEA93C19BB79A700133766 /* MPException.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B0F69A819028C6000817707 /* MPException.m */; };
3BBEA93D19BB79A700133766 /* NSString+MPExpressionElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BFAC39B1997BC7600B3EF67 /* NSString+MPExpressionElement.m */; };
3BBEA93E19BB79A700133766 /* NSIndexPath+MPAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BB09EDD190728220080A5ED /* NSIndexPath+MPAdditions.m */; };
3BBEA93F19BB79A700133766 /* MPExpressionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B87E3551900856F00259938 /* MPExpressionView.m */; };
@@ -162,8 +160,6 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
3B0F69A719028BC600817707 /* MPException.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPException.h; sourceTree = "<group>"; };
3B0F69A819028C6000817707 /* MPException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPException.m; sourceTree = "<group>"; };
3B0F69AB1902A82C00817707 /* MPExpressionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MPExpressionTests.m; path = ../MathPadTests/MPExpressionTests.m; sourceTree = "<group>"; };
3B3A4AAC19F71855001E9D54 /* MPRootFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPRootFunction.h; sourceTree = "<group>"; };
3B3A4AAD19F71855001E9D54 /* MPRootFunction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPRootFunction.m; sourceTree = "<group>"; };
@@ -427,6 +423,7 @@
isa = PBXGroup;
children = (
3BC46B4B19B38CB60033F13A /* Base Expression Classes */,
3B69B68219E6E8A50028E608 /* Expression Tree */,
3BB09EBC1905EF210080A5ED /* Functions */,
3BC46B4C19B38CD20033F13A /* Independant Classes */,
3BC46B4D19B38CFB0033F13A /* Helpers */,
@@ -515,6 +512,8 @@
3BFAC38D1997B61300B3EF67 /* MPExpression.h */,
3BFAC38E1997B61300B3EF67 /* MPExpression.m */,
3BFAC3961997B67400B3EF67 /* MPExpressionElement.h */,
3BFAC39A1997BC7600B3EF67 /* NSString+MPExpressionElement.h */,
3BFAC39B1997BC7600B3EF67 /* NSString+MPExpressionElement.m */,
3B87E35E19009D5F00259938 /* MPFunction.h */,
3B87E35F19009D5F00259938 /* MPFunction.m */,
3B69B6B719E935E20028E608 /* MPSuffixFunction.h */,
@@ -527,7 +526,6 @@
3B7B3A5319CC50B1005849E5 /* MPFunction+MPToken.m */,
3BB18AA319CDB3A900986DA0 /* MPTokenStream.h */,
3BB18AA419CDB3A900986DA0 /* MPTokenStream.m */,
3B69B68219E6E8A50028E608 /* Expression Tree */,
3BC46B4F19B506F20033F13A /* Evaluation */,
);
name = "Base Expression Classes";
@@ -538,8 +536,6 @@
children = (
3B87E35B1900933200259938 /* MPRangePath.h */,
3B87E35C1900933200259938 /* MPRangePath.m */,
3B0F69A719028BC600817707 /* MPException.h */,
3B0F69A819028C6000817707 /* MPException.m */,
);
name = "Independant Classes";
sourceTree = "<group>";
@@ -547,8 +543,6 @@
3BC46B4D19B38CFB0033F13A /* Helpers */ = {
isa = PBXGroup;
children = (
3BFAC39A1997BC7600B3EF67 /* NSString+MPExpressionElement.h */,
3BFAC39B1997BC7600B3EF67 /* NSString+MPExpressionElement.m */,
3BB09EDC190728220080A5ED /* NSIndexPath+MPAdditions.h */,
3BB09EDD190728220080A5ED /* NSIndexPath+MPAdditions.m */,
3B52CEDA19BEE63000CEDCFC /* NSRegularExpression+MPParsingAdditions.h */,
@@ -682,7 +676,6 @@
3B85834319BB653700D76A8D /* MPSumFunction.h in Headers */,
3B85834119BB651E00D76A8D /* MPRangePath.h in Headers */,
3B69B6C119E953590028E608 /* MPFactorial.h in Headers */,
3B85834219BB652900D76A8D /* MPException.h in Headers */,
3B69B69D19E6F2110028E608 /* MPNumber.h in Headers */,
3B85834519BB655200D76A8D /* NSIndexPath+MPAdditions.h in Headers */,
3B5FF73B19DB2FF500C8348A /* MPPowerFunction.h in Headers */,
@@ -905,7 +898,6 @@
3BBEA93E19BB79A700133766 /* NSIndexPath+MPAdditions.m in Sources */,
3B52CEDD19BEE63000CEDCFC /* NSRegularExpression+MPParsingAdditions.m in Sources */,
3B69B67D19E4915E0028E608 /* MPFractionFunction.m in Sources */,
3BBEA93C19BB79A700133766 /* MPException.m in Sources */,
3B69B68E19E6EB0D0028E608 /* MPProduct.m in Sources */,
3B69B6B619E88E750028E608 /* MPUnexpectedSymbolValue.m in Sources */,
3BF59AFF19D80ECC00E54292 /* MPFunctionsViewController.m in Sources */,

View File

@@ -6,7 +6,7 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
@class MPEvaluationContext;
@interface MPEvaluationContext : NSObject

View File

@@ -1,15 +0,0 @@
//
// MPException.h
// MathPad
//
// Created by Kim Wittenburg on 19.04.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#ifndef MathPad_MPException_h
#define MathPad_MPException_h
FOUNDATION_EXPORT NSString *MPIllegalElementException;
FOUNDATION_EXPORT NSString *MPIllegalElementExceptionElementKey;
#endif

View File

@@ -1,12 +0,0 @@
//
// MPException.m
// MathPad
//
// Created by Kim Wittenburg on 19.04.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import "MPException.h"
NSString *MPIllegalElementException = @"MPIllegalSymbolException";
NSString *MPIllegalElementExceptionElementKey = @"MPIllegalSymbolExceptionSymbolKey";

View File

@@ -6,9 +6,7 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Foundation;
#import "NSString+MPExpressionElement.h"
#import "MPToken.h"
FOUNDATION_EXPORT NSString *const MPIllegalElementExceptionElementKey;
FOUNDATION_EXPORT NSString *const MPMathKitErrorDomain;
FOUNDATION_EXPORT NSString *const MPExpressionPathErrorKey;
@@ -36,7 +34,7 @@ typedef NS_ENUM(NSUInteger, MPReferenceFrame) {
};
@class MPExpression, MPFunction, MPRangePath, MPExpressionTree, MPExpressionEvaluator;
@protocol MPExpressionElement;
@protocol MPExpressionElement, MPToken;
/*!
@class MPExpression

View File

@@ -7,17 +7,20 @@
//
#import "MPExpression.h"
#import "MPExpressionElement.h"
#import "MPFunction.h"
#import "MPRangePath.h"
#import "NSIndexPath+MPAdditions.h"
#import "MPException.h"
#import "MPExpressionTokenizer.h"
#import "MPTokenStream.h"
#import "MPToken.h"
#import "MPExpressionTree.h"
#import "NSIndexPath+MPAdditions.h"
NSString *const MPIllegalElementExceptionElementKey = @"MPIllegalElementExceptionElementKey";
NSString *const MPMathKitErrorDomain = @"MPMathKitErrorDomain";
NSString *const MPExpressionPathErrorKey = @"MPExpressionPathErrorKey";
@@ -93,7 +96,7 @@ NSString *const MPExpressionPathErrorKey = @"MPExpressionPathErrorKey";
{
for (id element in elements) {
if (![element conformsToProtocol:@protocol(MPExpressionElement)]) {
@throw [NSException exceptionWithName:MPIllegalElementException
@throw [NSException exceptionWithName:@"MPIllegalElementException"
reason:@"Elements must conform to the MPExpressionElement protocol."
userInfo:@{MPIllegalElementExceptionElementKey: element}];
}

View File

@@ -6,8 +6,6 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Foundation;
@protocol MPExpressionElement <NSObject, NSCopying, NSCoding>
- (BOOL)isString;

View File

@@ -6,14 +6,9 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Cocoa;
#import "MPLayout.h"
#import "MPExpression.h"
#import "MPFunctionLayout.h"
#define kMPEmptyBoxWidth (self.usesSmallSize ? 2.0 : 3.0)
#define kMPEmptyBoxHeight (CTFontGetDescent((CTFontRef)self.font) + CTFontGetAscent((CTFontRef)self.font) + CTFontGetLeading((CTFontRef)self.font))
#define kMPEmptyBoxYOrigin (-(CTFontGetDescent((CTFontRef)self.font) + CTFontGetLeading((CTFontRef)self.font)))
@class MPExpressionLayout, MPExpression, MPFunctionLayout;
@interface MPExpressionLayout : MPLayout

View File

@@ -7,17 +7,16 @@
//
#import "MPExpressionLayout.h"
#import "MPFunctionLayout.h"
#import "MPExpression.h"
#import "MPExpressionElement.h"
#import "MPPowerFunction.h"
#import "MPFunctionLayout.h"
#import "MPPowerFunctionLayout.h"
#import "NSString+MPExpressionElement.h"
#import "NSIndexPath+MPAdditions.h"
#define kMPEmptyBoxDrawingWidth kMPEmptyBoxWidth
#define kMPEmptyBoxDrawingHeight (CTFontGetDescent((CTFontRef)self.font) + CTFontGetAscent((CTFontRef)self.font))
#define kMPEmptyBoxDrawingYOrigin (-(CTFontGetDescent((CTFontRef)self.font) + CTFontGetLeading((CTFontRef)self.font)/2))
@interface MPExpressionLayout (MPLineGeneration)
- (CTLineRef)lineForElementAtIndex:(NSUInteger)index;

View File

@@ -7,9 +7,11 @@
//
#import "MPExpressionStorage.h"
#import "MPExpressionView.h"
#import "MPLayout.h"
#import "MPExpressionLayout.h"
#import "MPFunctionLayout.h"
#import "MPRangePath.h"
@interface MPExpressionStorage ()

View File

@@ -6,8 +6,7 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MPExpression.h"
@class MPExpressionTokenizer, MPExpression;
@interface MPExpressionTokenizer : NSObject

View File

@@ -7,15 +7,16 @@
//
#import "MPExpressionTokenizer.h"
#import "MPExpression.h"
#import "MPExpressionElement.h"
#import "MPToken.h"
#import "MPFunction+MPToken.h"
#import "NSRegularExpression+MPParsingAdditions.h"
#define MPRangeExists(range) (range.location != NSNotFound)
@implementation MPExpressionTokenizer
+ (NSArray *)tokenizeExpression:(MPExpression *)expression

View File

@@ -6,10 +6,10 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MPSummand.h"
#import "MPExpressionTreeElement.h"
@class MPExpressionTree;
@interface MPExpressionTree : NSObject <MPExpressionTreeElement>
@property (nonatomic, copy) NSString *definedVariable;

View File

@@ -8,6 +8,13 @@
#import "MPExpressionTree.h"
#import "MPSummand.h"
#import "MPTokenStream.h"
#import "MPToken.h"
#import "MPExpression.h"
@implementation MPExpressionTree {
NSMutableArray *_summands;
}

View File

@@ -6,9 +6,7 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MPTokenStream.h"
#import "MPExpression.h"
@class MPTokenStream;
@protocol MPExpressionTreeElement <NSObject>
@required

View File

@@ -8,8 +8,6 @@
// TODO: Undo/Redo + Delegate
#import <Cocoa/Cocoa.h>
@class MPExpressionView, MPExpressionStorage, MPExpressionLayout, MPRangePath;
@interface MPExpressionView : NSView

View File

@@ -7,24 +7,23 @@
//
#import "MPExpressionView.h"
#import "MPExpressionStorage.h"
#import "MPExpressionLayout.h"
#import "MPFunctionLayout.h"
#import "MPExpression.h"
#import "MPExpressionElement.h"
#import "MPPowerFunction.h"
#import "MPParenthesisFunction.h"
#import "MPFractionFunction.h"
#import "MPRangePath.h"
#import "MPMathRules.h"
#import "NSIndexPath+MPAdditions.h"
#import "MPSumFunction.h"
#import "MPParenthesisFunction.h"
#import "MPParenthesisFunctionLayout.h"
#import "MPExpressionStorage.h"
#import "MPExpressionLayout.h"
#import "MPFunctionsViewController.h"
#import "NSIndexPath+MPAdditions.h"
@interface MPExpressionView ()

View File

@@ -6,10 +6,10 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MPExpressionTreeElement.h"
#import "MPValueGroup.h"
#import "MPOperatorChain.h"
@class MPFactor, MPOperatorChain;
@protocol MPValue;
@interface MPFactor : NSObject <MPExpressionTreeElement>

View File

@@ -7,6 +7,14 @@
//
#import "MPFactor.h"
#import "MPOperatorChain.h"
#import "MPValueGroup.h"
#import "MPTokenStream.h"
#import "MPToken.h"
#import "MPExpression.h"
#import "MPMathRules.h"
@implementation MPFactor {

View File

@@ -6,9 +6,10 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "MPValueGroup.h"
@class MPFactorial;
@interface MPFactorial : NSObject <MPValue>
@property (readonly, nonatomic, strong) id<MPValue> value;

View File

@@ -8,6 +8,9 @@
#import "MPFactorial.h"
#import "MPTokenStream.h"
#import "MPToken.h"
@implementation MPFactorial
- (instancetype)init

View File

@@ -6,7 +6,9 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <MathKit/MathKit.h>
#import "MPFunction.h"
@class MPFractionFunction, MPExpression;
@interface MPFractionFunction : MPFunction

View File

@@ -8,6 +8,7 @@
#import "MPFractionFunction.h"
#import "MPExpression.h"
#import "MPExpressionTree.h"
@implementation MPFractionFunction

View File

@@ -7,7 +7,8 @@
//
#import "MPFunctionLayout.h"
#import "MPFractionFunction.h"
@class MPFractionFunctionLayout, MPFractionFunction;
@interface MPFractionFunctionLayout : MPFunctionLayout

View File

@@ -7,7 +7,8 @@
//
#import "MPFractionFunctionLayout.h"
#import "MPExpressionLayout.h"
#import "MPFractionFunction.h"
#define kFractionFunctionLineWidth 1.0
#define kFractionFunctionHorizontalInset 2.0

View File

@@ -6,7 +6,7 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <MathKit/MathKit.h>
#import "MPFunction.h"
#import "MPToken.h"
@interface MPFunction (MPToken) <MPToken>

View File

@@ -8,6 +8,8 @@
#import "MPFunction+MPToken.h"
#import "MPExpression.h"
@implementation MPFunction (MPToken)
- (MPTokenType)tokenType

View File

@@ -6,9 +6,8 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <MathKit/MathKit.h>
#import "MPFunction.h"
#import "MPValueGroup.h"
#import "MPFunction+MPToken.h"
@interface MPFunction (MPValue) <MPValue>

View File

@@ -8,6 +8,8 @@
#import "MPFunction+MPValue.h"
#import "MPFunction+MPToken.h"
@implementation MPFunction (MPValue)
- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream

View File

@@ -6,7 +6,6 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Foundation;
#import "MPExpressionElement.h"
#define MPFunctionAccessorImplementation(Accessor, variableName) \
@@ -19,6 +18,7 @@
}
@class MPFunction, MPExpression, MPRangePath;
@protocol MPExpressionElement;
@interface MPFunction : NSObject <NSCoding, NSCopying, MPExpressionElement>

View File

@@ -7,18 +7,13 @@
//
#import "MPFunction.h"
#import "MPExpression.h"
#import "MPRangePath.h"
#import "NSIndexPath+MPAdditions.h"
@implementation MPFunction
+ (NSString *)localizedFunctionName
{
return NSLocalizedString(@"Function", @"Name of Generic Function.");
}
#pragma mark Creation Methods
- (instancetype)init
{

View File

@@ -6,9 +6,10 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Cocoa;
#import "MPLayout.h"
@class MPFunctionLayout, MPFunction, MPExpressionLayout;
@interface MPFunctionLayout : MPLayout
+ (MPFunctionLayout *)functionLayoutForFunction:(MPFunction *)function

View File

@@ -7,18 +7,21 @@
//
#import "MPFunctionLayout.h"
#import "MPFunction.h"
#import "MPExpressionLayout.h"
#import "MPExpression.h"
#import "MPFunction.h"
#import "MPSumFunction.h"
#import "MPSumFunctionLayout.h"
#import "MPParenthesisFunction.h"
#import "MPPowerFunction.h"
#import "MPFractionFunction.h"
#import "MPRootFunction.h"
#import "MPExpressionLayout.h"
#import "MPSumFunctionLayout.h"
#import "MPParenthesisFunctionLayout.h"
#import "MPPowerFunctionLayout.h"
#import "MPFractionFunctionLayout.h"
#import "MPFractionFunction.h"
#import "MPRootFunctionLayout.h"
#import "MPRootFunction.h"
#import "NSIndexPath+MPAdditions.h"

View File

@@ -6,11 +6,10 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "MPPowerFunction.h"
#import "MPFunction+MPValue.h"
#import "MPValueGroup.h"
@class MPFunctionValue, MPPowerFunction, MPValueGroup;
@interface MPFunctionValue : NSObject <MPValue>
@property (readonly, nonatomic, copy) NSString *functionName;

View File

@@ -7,6 +7,11 @@
//
#import "MPFunctionValue.h"
#import "MPTokenStream.h"
#import "MPToken.h"
#import "MPExpression.h"
#import "MPMathRules.h"
double defaultFunction(double value) {return value;};

View File

@@ -6,9 +6,7 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class MPFunctionsCollectionView;
@class MPFunctionsViewController, MPFunctionsCollectionView;
@interface MPFunctionsViewController : NSViewController

View File

@@ -7,16 +7,18 @@
//
#import "MPFunctionsViewController.h"
#import "MPFunction.h"
#import "MPFunctionLayout.h"
#import "MPExpression.h"
#import "NSString+MPExpressionElement.h"
#import "MPFunction.h"
#import "MPSumFunction.h"
#import "MPParenthesisFunction.h"
#import "MPPowerFunction.h"
#import "MPFractionFunction.h"
#import "MPFunctionLayout.h"
@class MPFunctionTemplateItem;
@class MPFunctionsCollectionView, MPFunctionTemplateView, MPFunctionTemplateItem;
@interface MPFunctionsCollectionView : NSCollectionView

View File

@@ -6,8 +6,15 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Cocoa;
#import "MPExpressionStorage.h"
#define kMPEmptyBoxWidth (self.usesSmallSize ? 2.0 : 3.0)
#define kMPEmptyBoxHeight (CTFontGetDescent((CTFontRef)self.font) + CTFontGetAscent((CTFontRef)self.font) + CTFontGetLeading((CTFontRef)self.font))
#define kMPEmptyBoxYOrigin (-(CTFontGetDescent((CTFontRef)self.font) + CTFontGetLeading((CTFontRef)self.font)))
#define kMPEmptyBoxDrawingWidth kMPEmptyBoxWidth
#define kMPEmptyBoxDrawingHeight (CTFontGetDescent((CTFontRef)self.font) + CTFontGetAscent((CTFontRef)self.font))
#define kMPEmptyBoxDrawingYOrigin (-(CTFontGetDescent((CTFontRef)self.font) + CTFontGetLeading((CTFontRef)self.font)/2))
@class MPLayout, MPRangePath;
@interface MPLayout : NSObject

View File

@@ -7,8 +7,8 @@
//
#import "MPLayout.h"
#import "MPRangePath.h"
#import "MPRangePath.h"
#import "NSIndexPath+MPAdditions.h"
@interface MPLayout ()

View File

@@ -6,12 +6,12 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
FOUNDATION_EXPORT NSString *MPMathRulesMaximumOperatorChainLengthKey;
FOUNDATION_EXPORT NSString *MPMathRulesMaximumOperatorChainLengthInMultiplicationKey;
FOUNDATION_EXPORT NSString *MPMathRulesIsUsingDegreesKey;
@class MPMathRules;
@interface MPMathRules : NSObject
+ (MPMathRules *)sharedRules;

View File

@@ -6,9 +6,10 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MPValueGroup.h"
@class MPNumber;
@interface MPNumber : NSObject <MPValue>
@property (readonly, nonatomic, strong) NSDecimalNumber *number;

View File

@@ -8,6 +8,9 @@
#import "MPNumber.h"
#import "MPTokenStream.h"
#import "MPToken.h"
@implementation MPNumber
- (instancetype)init

View File

@@ -6,9 +6,10 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "MPExpressionTreeElement.h"
@class MPOperatorChain;
@interface MPOperatorChain : NSObject <MPExpressionTreeElement>
@property (readonly, nonatomic) BOOL negating;

View File

@@ -8,6 +8,9 @@
#import "MPOperatorChain.h"
#import "MPTokenStream.h"
#import "MPToken.h"
@implementation MPOperatorChain
- (id)init

View File

@@ -6,7 +6,9 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <MathKit/MathKit.h>
#import "MPFunction.h"
@class MPParenthesisFunction, MPExpression;
@interface MPParenthesisFunction : MPFunction

View File

@@ -9,6 +9,7 @@
#import "MPParenthesisFunction.h"
#import "MPExpression.h"
#import "MPExpressionTree.h"
@implementation MPParenthesisFunction

View File

@@ -7,7 +7,8 @@
//
#import "MPFunctionLayout.h"
#import "MPParenthesisFunction.h"
@class MPParenthesisFunctionLayout, MPParenthesisFunction;
@interface MPParenthesisFunctionLayout : MPFunctionLayout

View File

@@ -8,6 +8,8 @@
#import "MPParenthesisFunctionLayout.h"
#import "MPParenthesisFunction.h"
#define MPParenthesisFunctionOpeningParensOffset 2
#define MPParenthesisFunctionClosingParensOffset 0

View File

@@ -6,9 +6,10 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <MathKit/MathKit.h>
#import "MPSuffixFunction.h"
@class MPPowerFunction, MPExpression;
@interface MPPowerFunction : MPSuffixFunction
@property (nonatomic, strong) MPExpression *exponentExpression;

View File

@@ -7,10 +7,12 @@
//
#import "MPPowerFunction.h"
#import "MPExpression.h"
#import "MPExpression.h"
#import "MPExpressionTree.h"
#import "MPValueGroup.h"
@implementation MPPowerFunction
MPFunctionAccessorImplementation(ExponentExpression, _exponentExpression)

View File

@@ -8,7 +8,7 @@
#import "MPFunctionLayout.h"
#import "MPPowerFunction.h"
@class MPPowerFunctionLayout, MPPowerFunction;
@interface MPPowerFunctionLayout : MPFunctionLayout

View File

@@ -7,7 +7,8 @@
//
#import "MPPowerFunctionLayout.h"
#import "MPExpressionLayout.h"
#import "MPPowerFunction.h"
#define kPowerFunctionExponentXOffset 1
#define kPowerFunctionTrailingOffset 2

View File

@@ -6,9 +6,9 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MPExpressionTreeElement.h"
#import "MPFactor.h"
@class MPProduct;
@interface MPProduct : NSObject <MPExpressionTreeElement>

View File

@@ -7,8 +7,15 @@
//
#import "MPProduct.h"
#import "MPFactor.h"
#import "MPValueGroup.h"
#import "MPTokenStream.h"
#import "MPToken.h"
#import "MPExpression.h"
@implementation MPProduct {
NSMutableArray *_factors;
}

View File

@@ -6,8 +6,6 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Foundation;
#import "MPExpression.h"
#define MPMakeRangePath(loc, len) [MPRangePath rangePathWithLocation:(loc) length:(len)]

View File

@@ -7,7 +7,6 @@
//
#import "MPRangePath.h"
#import "MPExpression.h"
@implementation MPRangePath

View File

@@ -6,7 +6,9 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <MathKit/MathKit.h>
#import "MPFunction.h"
@class MPRootFunction, MPExpression;
@interface MPRootFunction : MPFunction

View File

@@ -8,6 +8,7 @@
#import "MPRootFunction.h"
#import "MPExpression.h"
#import "MPExpressionTree.h"
@implementation MPRootFunction

View File

@@ -7,7 +7,8 @@
//
#import "MPFunctionLayout.h"
#import "MPRootFunction.h"
@class MPRootFunctionLayout, MPRootFunction;
@interface MPRootFunctionLayout : MPFunctionLayout

View File

@@ -8,6 +8,8 @@
#import "MPRootFunctionLayout.h"
#import "MPRootFunction.h"
#define kRootFunctionSpaceBetweenRadicantAndExponent 5
@implementation MPRootFunctionLayout

View File

@@ -6,9 +6,10 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <MathKit/MathKit.h>
#import "MPFunction.h"
#import "MPValueGroup.h"
@class MPSuffixFunction;
@protocol MPValue;
@interface MPSuffixFunction : MPFunction

View File

@@ -6,7 +6,6 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Foundation;
#import "MPFunction.h"
@class MPSumFunction, MPExpression;

View File

@@ -7,11 +7,10 @@
//
#import "MPSumFunction.h"
#import "MPExpression.h"
#import "MPEvaluationContext.h"
#import "MPExpressionTree.h"
#import "MPEvaluationContext.h"
@implementation MPSumFunction

View File

@@ -7,6 +7,7 @@
//
#import "MPSumFunctionLayout.h"
#import "MPSumFunction.h"
#import "NSIndexPath+MPAdditions.h"

View File

@@ -6,10 +6,9 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MPExpressionTreeElement.h"
#import "MPProduct.h"
#import "MPOperatorChain.h"
@class MPSummand, MPOperatorChain, MPProduct;
@interface MPSummand : NSObject <MPExpressionTreeElement>

View File

@@ -7,6 +7,14 @@
//
#import "MPSummand.h"
#import "MPOperatorChain.h"
#import "MPProduct.h"
#import "MPTokenStream.h"
#import "MPToken.h"
#import "MPExpression.h"
#import "MPMathRules.h"
@implementation MPSummand

View File

@@ -6,7 +6,8 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
@class MPToken;
@protocol MPToken;
typedef NS_ENUM(NSUInteger, MPTokenType) {
MPEOFToken = 0,

View File

@@ -6,8 +6,8 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MPToken.h"
@class MPTokenStream;
@protocol MPToken;
@interface MPTokenStream : NSObject
@@ -21,8 +21,8 @@
- (BOOL)hasMoreTokens;
- (MPToken *)currentToken;
- (MPToken *)peekNextToken;
- (id<MPToken>)currentToken;
- (id<MPToken>)peekNextToken;
- (void)currentTokenConsumed;
@end

View File

@@ -8,6 +8,8 @@
#import "MPTokenStream.h"
#import "MPToken.h"
@implementation MPTokenStream {
NSUInteger _currentTokenIndex;
NSUInteger eofLocation;
@@ -86,7 +88,7 @@
return _currentTokenIndex < self.tokens.count;
}
- (MPToken *)currentToken
- (id<MPToken>)currentToken
{
[self skipWhitespaces];
if (_currentTokenIndex >= _tokens.count) {
@@ -95,11 +97,11 @@
return _tokens[_currentTokenIndex];
}
- (MPToken *)peekNextToken
- (id<MPToken>)peekNextToken
{
NSUInteger currentTokenIndex = _currentTokenIndex;
[self currentTokenConsumed]; // Pretend the current token has been consumed
MPToken *token = [self currentToken];
id<MPToken> token = [self currentToken];
_currentTokenIndex = currentTokenIndex; // Undo the lookahead
return token;
}

View File

@@ -6,9 +6,10 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "MPValueGroup.h"
@class MPUnexpectedSymbolValue;
@interface MPUnexpectedSymbolValue : NSObject <MPValue>
@property (readonly, nonatomic, copy) NSString *symbol;

View File

@@ -8,6 +8,11 @@
#import "MPUnexpectedSymbolValue.h"
#import "MPTokenStream.h"
#import "MPToken.h"
#import "MPExpression.h"
@implementation MPUnexpectedSymbolValue
- (instancetype)init

View File

@@ -6,8 +6,11 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MPExpressionTreeElement.h"
#import "MPTokenStream.h"
@class MPValueGroup;
@protocol MPValue;
@protocol MPValue <MPExpressionTreeElement>

View File

@@ -7,12 +7,17 @@
//
#import "MPValueGroup.h"
#import "MPNumber.h"
#import "MPVariable.h"
#import "MPFunction+MPValue.h"
#import "MPUnexpectedSymbolValue.h"
#import "MPFunctionValue.h"
#import "MPUnexpectedSymbolValue.h"
#import "MPFactorial.h"
#import "MPTokenStream.h"
#import "MPToken.h"
#import "MPExpression.h"
#import "MPSuffixFunction.h"
@implementation MPValueGroup {

View File

@@ -6,9 +6,10 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MPValueGroup.h"
@class MPVariable;
@interface MPVariable : NSObject <MPValue>
@property (readonly, nonatomic, strong) NSString *variableName;

View File

@@ -7,6 +7,11 @@
//
#import "MPVariable.h"
#import "MPTokenStream.h"
#import "MPToken.h"
#import "MPExpression.h"
#import "MPEvaluationContext.h"
@implementation MPVariable {

View File

@@ -6,7 +6,7 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class MPWhiteView;
@interface MPWhiteView : NSView

View File

@@ -6,8 +6,6 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Foundation;
@interface NSIndexPath (MPAdditions)
- (NSUInteger)firstIndex;

View File

@@ -6,8 +6,6 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import <Foundation/Foundation.h>
#define MPStringRange(string) NSMakeRange(0, [string length])
#define MPStringRangeFrom(from, string) NSMakeRange(from, [string length]-from)

View File

@@ -6,7 +6,6 @@
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Foundation;
#import "MPExpressionElement.h"
@interface NSString (MPExpressionElement) <MPExpressionElement>