diff --git a/MathKit/MathKit.h b/MathKit/MathKit.h index c9831f9..29a4216 100644 --- a/MathKit/MathKit.h +++ b/MathKit/MathKit.h @@ -10,31 +10,16 @@ #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" diff --git a/MathPad.xcodeproj/project.pbxproj b/MathPad.xcodeproj/project.pbxproj index 0b0c1ce..5042cad 100644 --- a/MathPad.xcodeproj/project.pbxproj +++ b/MathPad.xcodeproj/project.pbxproj @@ -7,10 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 3B3A4AAE19F71855001E9D54 /* MPRootFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B3A4AAC19F71855001E9D54 /* MPRootFunction.h */; }; - 3B3A4AAF19F71855001E9D54 /* MPRootFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B3A4AAD19F71855001E9D54 /* MPRootFunction.m */; }; - 3B3A4AB219F71A11001E9D54 /* MPRootFunctionLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B3A4AB019F71A11001E9D54 /* MPRootFunctionLayout.h */; }; - 3B3A4AB319F71A11001E9D54 /* MPRootFunctionLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B3A4AB119F71A11001E9D54 /* MPRootFunctionLayout.m */; }; 3B52CEC119BB9FA900CEDCFC /* MathKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B85830D19BB5E5500D76A8D /* MathKit.framework */; }; 3B52CEDC19BEE63000CEDCFC /* NSRegularExpression+MPParsingAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B52CEDA19BEE63000CEDCFC /* NSRegularExpression+MPParsingAdditions.h */; }; 3B52CEDD19BEE63000CEDCFC /* NSRegularExpression+MPParsingAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B52CEDB19BEE63000CEDCFC /* NSRegularExpression+MPParsingAdditions.m */; }; @@ -24,33 +20,12 @@ 3B69B67D19E4915E0028E608 /* MPFractionFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B67B19E4915E0028E608 /* MPFractionFunction.m */; }; 3B69B68019E493630028E608 /* MPFractionFunctionLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B67E19E493630028E608 /* MPFractionFunctionLayout.h */; }; 3B69B68119E493630028E608 /* MPFractionFunctionLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B67F19E493630028E608 /* MPFractionFunctionLayout.m */; }; - 3B69B68519E6E8B20028E608 /* MPExpressionTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B68319E6E8B20028E608 /* MPExpressionTree.h */; }; - 3B69B68619E6E8B20028E608 /* MPExpressionTree.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B68419E6E8B20028E608 /* MPExpressionTree.m */; }; - 3B69B68919E6E9280028E608 /* MPSummand.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B68719E6E9280028E608 /* MPSummand.h */; }; - 3B69B68A19E6E9280028E608 /* MPSummand.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B68819E6E9280028E608 /* MPSummand.m */; }; - 3B69B68D19E6EB0D0028E608 /* MPProduct.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B68B19E6EB0D0028E608 /* MPProduct.h */; }; - 3B69B68E19E6EB0D0028E608 /* MPProduct.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B68C19E6EB0D0028E608 /* MPProduct.m */; }; - 3B69B69019E6ED6E0028E608 /* MPExpressionTreeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B68F19E6ED6E0028E608 /* MPExpressionTreeElement.h */; }; - 3B69B69719E6F0780028E608 /* MPValueGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B69519E6F0780028E608 /* MPValueGroup.h */; }; - 3B69B69819E6F0780028E608 /* MPValueGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B69619E6F0780028E608 /* MPValueGroup.m */; }; 3B69B69D19E6F2110028E608 /* MPNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B69B19E6F2110028E608 /* MPNumber.h */; }; 3B69B69E19E6F2110028E608 /* MPNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B69C19E6F2110028E608 /* MPNumber.m */; }; 3B69B6A119E6F2420028E608 /* MPVariable.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B69F19E6F2420028E608 /* MPVariable.h */; }; 3B69B6A219E6F2420028E608 /* MPVariable.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B6A019E6F2420028E608 /* MPVariable.m */; }; - 3B69B6A919E6F2AF0028E608 /* MPFunction+MPValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B6A719E6F2AF0028E608 /* MPFunction+MPValue.h */; }; - 3B69B6AA19E6F2AF0028E608 /* MPFunction+MPValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B6A819E6F2AF0028E608 /* MPFunction+MPValue.m */; }; - 3B69B6B119E8175F0028E608 /* MPFactor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B6AF19E8175F0028E608 /* MPFactor.h */; }; - 3B69B6B219E8175F0028E608 /* MPFactor.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B6B019E8175F0028E608 /* MPFactor.m */; }; - 3B69B6B519E88E750028E608 /* MPUnexpectedSymbolValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B6B319E88E750028E608 /* MPUnexpectedSymbolValue.h */; }; - 3B69B6B619E88E750028E608 /* MPUnexpectedSymbolValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B6B419E88E750028E608 /* MPUnexpectedSymbolValue.m */; }; - 3B69B6B919E935E20028E608 /* MPSuffixFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B6B719E935E20028E608 /* MPSuffixFunction.h */; }; - 3B69B6BA19E935E20028E608 /* MPSuffixFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B6B819E935E20028E608 /* MPSuffixFunction.m */; }; - 3B69B6BD19E948740028E608 /* MPFunctionValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B6BB19E948740028E608 /* MPFunctionValue.h */; }; - 3B69B6BE19E948740028E608 /* MPFunctionValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B6BC19E948740028E608 /* MPFunctionValue.m */; }; - 3B69B6C119E953590028E608 /* MPFactorial.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B6BF19E953590028E608 /* MPFactorial.h */; }; - 3B69B6C219E953590028E608 /* MPFactorial.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B6C019E953590028E608 /* MPFactorial.m */; }; - 3B69B6C519E95B250028E608 /* MPOperatorChain.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B6C319E95B250028E608 /* MPOperatorChain.h */; }; - 3B69B6C619E95B250028E608 /* MPOperatorChain.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B6C419E95B250028E608 /* MPOperatorChain.m */; }; + 3B69B6BD19E948740028E608 /* MPElementaryFunctionTerm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B69B6BB19E948740028E608 /* MPElementaryFunctionTerm.h */; }; + 3B69B6BE19E948740028E608 /* MPElementaryFunctionTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B69B6BC19E948740028E608 /* MPElementaryFunctionTerm.m */; }; 3B7172EA19C7147000FEAA5B /* FunctionsButtonDisclosure@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3B7172E819C7147000FEAA5B /* FunctionsButtonDisclosure@2x.png */; }; 3B7172EB19C7147000FEAA5B /* FunctionsButtonDisclosure.png in Resources */ = {isa = PBXBuildFile; fileRef = 3B7172E919C7147000FEAA5B /* FunctionsButtonDisclosure.png */; }; 3B7172EE19C9FA8E00FEAA5B /* MPParenthesisFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B7172EC19C9FA8E00FEAA5B /* MPParenthesisFunction.h */; }; @@ -86,6 +61,8 @@ 3B85834A19BB65B600D76A8D /* MPFunctionLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B528D11199417E90054DB5F /* MPFunctionLayout.h */; }; 3B85834B19BB65B600D76A8D /* MPSumFunctionLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BB09EDF190736160080A5ED /* MPSumFunctionLayout.h */; }; 3B85834C19BB661100D76A8D /* MathKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B85833219BB5F2D00D76A8D /* MathKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3B9265C71A2147DF00AD2809 /* MPNegatedTerm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B9265C51A2147DF00AD2809 /* MPNegatedTerm.h */; }; + 3B9265C81A2147DF00AD2809 /* MPNegatedTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B9265C61A2147DF00AD2809 /* MPNegatedTerm.m */; }; 3BB18AA519CDB3A900986DA0 /* MPTokenStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BB18AA319CDB3A900986DA0 /* MPTokenStream.h */; }; 3BB18AA619CDB3A900986DA0 /* MPTokenStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BB18AA419CDB3A900986DA0 /* MPTokenStream.m */; }; 3BBEA92C19BB680B00133766 /* MathKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B85830D19BB5E5500D76A8D /* MathKit.framework */; }; @@ -105,6 +82,28 @@ 3BBEA95019BB79EF00133766 /* MPRangeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BBBA3941905704200824E74 /* MPRangeTests.m */; }; 3BC4660B19B2425A0033F13A /* MPDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3BF9978318DE623E009CF6C4 /* MPDocument.xib */; }; 3BC4661419B245C60033F13A /* Fonts in Resources */ = {isa = PBXBuildFile; fileRef = 3BC4661319B245C60033F13A /* Fonts */; }; + 3BCA0C801A12619500C9E3E0 /* MPTerm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BCA0C7E1A12619500C9E3E0 /* MPTerm.h */; }; + 3BCA0C811A12619500C9E3E0 /* MPTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BCA0C7F1A12619500C9E3E0 /* MPTerm.m */; }; + 3BCA0C851A1405C000C9E3E0 /* MPFunctionTerm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BCA0C831A1405C000C9E3E0 /* MPFunctionTerm.h */; }; + 3BCA0C861A1405C000C9E3E0 /* MPFunctionTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BCA0C841A1405C000C9E3E0 /* MPFunctionTerm.m */; }; + 3BEFF74D1A16A4DA00301C0C /* MPSumTerm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BEFF74B1A16A4DA00301C0C /* MPSumTerm.h */; }; + 3BEFF74E1A16A4DA00301C0C /* MPSumTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BEFF74C1A16A4DA00301C0C /* MPSumTerm.m */; }; + 3BEFF7511A16B06600301C0C /* MPParsedExpression.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BEFF74F1A16B06600301C0C /* MPParsedExpression.h */; }; + 3BEFF7521A16B06600301C0C /* MPParsedExpression.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BEFF7501A16B06600301C0C /* MPParsedExpression.m */; }; + 3BEFF7551A17AA3200301C0C /* MPProductTerm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BEFF7531A17AA3200301C0C /* MPProductTerm.h */; }; + 3BEFF7561A17AA3200301C0C /* MPProductTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BEFF7541A17AA3200301C0C /* MPProductTerm.m */; }; + 3BEFF7621A1804AF00301C0C /* MPFactorialTerm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BEFF7601A1804AF00301C0C /* MPFactorialTerm.h */; }; + 3BEFF7631A1804AF00301C0C /* MPFactorialTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BEFF7611A1804AF00301C0C /* MPFactorialTerm.m */; }; + 3BEFF7661A18066300301C0C /* MPSumFunctionTerm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BEFF7641A18066300301C0C /* MPSumFunctionTerm.h */; }; + 3BEFF7671A18066300301C0C /* MPSumFunctionTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BEFF7651A18066300301C0C /* MPSumFunctionTerm.m */; }; + 3BEFF76A1A1807B000301C0C /* MPParenthesisTerm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BEFF7681A1807B000301C0C /* MPParenthesisTerm.h */; }; + 3BEFF76B1A1807B000301C0C /* MPParenthesisTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BEFF7691A1807B000301C0C /* MPParenthesisTerm.m */; }; + 3BEFF76E1A18083C00301C0C /* MPPowerTerm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BEFF76C1A18083C00301C0C /* MPPowerTerm.h */; }; + 3BEFF76F1A18083C00301C0C /* MPPowerTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BEFF76D1A18083C00301C0C /* MPPowerTerm.m */; }; + 3BEFF7721A180C8800301C0C /* MPFractionTerm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BEFF7701A180C8800301C0C /* MPFractionTerm.h */; }; + 3BEFF7731A180C8800301C0C /* MPFractionTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BEFF7711A180C8800301C0C /* MPFractionTerm.m */; }; + 3BF54BB91A18D08400883BFA /* MPExpressionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BF54BB71A18D08400883BFA /* MPExpressionParser.h */; }; + 3BF54BBA1A18D08400883BFA /* MPExpressionParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF54BB81A18D08400883BFA /* MPExpressionParser.m */; }; 3BF59AFE19D80ECC00E54292 /* MPFunctionsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BF59AFB19D80ECC00E54292 /* MPFunctionsViewController.h */; }; 3BF59AFF19D80ECC00E54292 /* MPFunctionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BF59AFC19D80ECC00E54292 /* MPFunctionsViewController.m */; }; 3BF59B0019D80ECC00E54292 /* MPFunctionsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3BF59AFD19D80ECC00E54292 /* MPFunctionsViewController.xib */; }; @@ -161,10 +160,6 @@ /* Begin PBXFileReference section */ 3B0F69AB1902A82C00817707 /* MPExpressionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MPExpressionTests.m; path = ../MathPadTests/MPExpressionTests.m; sourceTree = ""; }; - 3B3A4AAC19F71855001E9D54 /* MPRootFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPRootFunction.h; sourceTree = ""; }; - 3B3A4AAD19F71855001E9D54 /* MPRootFunction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPRootFunction.m; sourceTree = ""; }; - 3B3A4AB019F71A11001E9D54 /* MPRootFunctionLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPRootFunctionLayout.h; sourceTree = ""; }; - 3B3A4AB119F71A11001E9D54 /* MPRootFunctionLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPRootFunctionLayout.m; sourceTree = ""; }; 3B528D0D199417740054DB5F /* MPLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPLayout.h; sourceTree = ""; }; 3B528D0E199417E10054DB5F /* MPExpressionLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPExpressionLayout.h; sourceTree = ""; }; 3B528D0F199417E10054DB5F /* MPExpressionLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPExpressionLayout.m; sourceTree = ""; }; @@ -183,33 +178,12 @@ 3B69B67B19E4915E0028E608 /* MPFractionFunction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPFractionFunction.m; sourceTree = ""; }; 3B69B67E19E493630028E608 /* MPFractionFunctionLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPFractionFunctionLayout.h; sourceTree = ""; }; 3B69B67F19E493630028E608 /* MPFractionFunctionLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPFractionFunctionLayout.m; sourceTree = ""; }; - 3B69B68319E6E8B20028E608 /* MPExpressionTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPExpressionTree.h; sourceTree = ""; }; - 3B69B68419E6E8B20028E608 /* MPExpressionTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPExpressionTree.m; sourceTree = ""; }; - 3B69B68719E6E9280028E608 /* MPSummand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSummand.h; sourceTree = ""; }; - 3B69B68819E6E9280028E608 /* MPSummand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPSummand.m; sourceTree = ""; }; - 3B69B68B19E6EB0D0028E608 /* MPProduct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPProduct.h; sourceTree = ""; }; - 3B69B68C19E6EB0D0028E608 /* MPProduct.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPProduct.m; sourceTree = ""; }; - 3B69B68F19E6ED6E0028E608 /* MPExpressionTreeElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPExpressionTreeElement.h; sourceTree = ""; }; - 3B69B69519E6F0780028E608 /* MPValueGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPValueGroup.h; sourceTree = ""; }; - 3B69B69619E6F0780028E608 /* MPValueGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPValueGroup.m; sourceTree = ""; }; 3B69B69B19E6F2110028E608 /* MPNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPNumber.h; sourceTree = ""; }; 3B69B69C19E6F2110028E608 /* MPNumber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPNumber.m; sourceTree = ""; }; 3B69B69F19E6F2420028E608 /* MPVariable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPVariable.h; sourceTree = ""; }; 3B69B6A019E6F2420028E608 /* MPVariable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPVariable.m; sourceTree = ""; }; - 3B69B6A719E6F2AF0028E608 /* MPFunction+MPValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MPFunction+MPValue.h"; sourceTree = ""; }; - 3B69B6A819E6F2AF0028E608 /* MPFunction+MPValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MPFunction+MPValue.m"; sourceTree = ""; }; - 3B69B6AF19E8175F0028E608 /* MPFactor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPFactor.h; sourceTree = ""; }; - 3B69B6B019E8175F0028E608 /* MPFactor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPFactor.m; sourceTree = ""; }; - 3B69B6B319E88E750028E608 /* MPUnexpectedSymbolValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPUnexpectedSymbolValue.h; sourceTree = ""; }; - 3B69B6B419E88E750028E608 /* MPUnexpectedSymbolValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPUnexpectedSymbolValue.m; sourceTree = ""; }; - 3B69B6B719E935E20028E608 /* MPSuffixFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSuffixFunction.h; sourceTree = ""; }; - 3B69B6B819E935E20028E608 /* MPSuffixFunction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPSuffixFunction.m; sourceTree = ""; }; - 3B69B6BB19E948740028E608 /* MPFunctionValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPFunctionValue.h; sourceTree = ""; }; - 3B69B6BC19E948740028E608 /* MPFunctionValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPFunctionValue.m; sourceTree = ""; }; - 3B69B6BF19E953590028E608 /* MPFactorial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPFactorial.h; sourceTree = ""; }; - 3B69B6C019E953590028E608 /* MPFactorial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPFactorial.m; sourceTree = ""; }; - 3B69B6C319E95B250028E608 /* MPOperatorChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPOperatorChain.h; sourceTree = ""; }; - 3B69B6C419E95B250028E608 /* MPOperatorChain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOperatorChain.m; sourceTree = ""; }; + 3B69B6BB19E948740028E608 /* MPElementaryFunctionTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPElementaryFunctionTerm.h; sourceTree = ""; }; + 3B69B6BC19E948740028E608 /* MPElementaryFunctionTerm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPElementaryFunctionTerm.m; sourceTree = ""; }; 3B7172E819C7147000FEAA5B /* FunctionsButtonDisclosure@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "FunctionsButtonDisclosure@2x.png"; sourceTree = ""; }; 3B7172E919C7147000FEAA5B /* FunctionsButtonDisclosure.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = FunctionsButtonDisclosure.png; sourceTree = ""; }; 3B7172EC19C9FA8E00FEAA5B /* MPParenthesisFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPParenthesisFunction.h; sourceTree = ""; }; @@ -239,6 +213,8 @@ 3B87E35C1900933200259938 /* MPRangePath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPRangePath.m; sourceTree = ""; }; 3B87E35E19009D5F00259938 /* MPFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPFunction.h; sourceTree = ""; }; 3B87E35F19009D5F00259938 /* MPFunction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPFunction.m; sourceTree = ""; }; + 3B9265C51A2147DF00AD2809 /* MPNegatedTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPNegatedTerm.h; sourceTree = ""; }; + 3B9265C61A2147DF00AD2809 /* MPNegatedTerm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPNegatedTerm.m; sourceTree = ""; }; 3BB09EB01905DE500080A5ED /* MPExpressionStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MPExpressionStorage.h; path = ../MathPad/MPExpressionStorage.h; sourceTree = ""; }; 3BB09EB11905DE500080A5ED /* MPExpressionStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MPExpressionStorage.m; path = ../MathPad/MPExpressionStorage.m; sourceTree = ""; }; 3BB09EC71906FD830080A5ED /* MPSumFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSumFunction.h; sourceTree = ""; }; @@ -253,6 +229,28 @@ 3BC4661319B245C60033F13A /* Fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Fonts; sourceTree = ""; }; 3BC4661519B365070033F13A /* MPArrayCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPArrayCache.h; sourceTree = ""; }; 3BC4661619B365070033F13A /* MPArrayCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPArrayCache.m; sourceTree = ""; }; + 3BCA0C7E1A12619500C9E3E0 /* MPTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPTerm.h; sourceTree = ""; }; + 3BCA0C7F1A12619500C9E3E0 /* MPTerm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPTerm.m; sourceTree = ""; }; + 3BCA0C831A1405C000C9E3E0 /* MPFunctionTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPFunctionTerm.h; sourceTree = ""; }; + 3BCA0C841A1405C000C9E3E0 /* MPFunctionTerm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPFunctionTerm.m; sourceTree = ""; }; + 3BEFF74B1A16A4DA00301C0C /* MPSumTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSumTerm.h; sourceTree = ""; }; + 3BEFF74C1A16A4DA00301C0C /* MPSumTerm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPSumTerm.m; sourceTree = ""; }; + 3BEFF74F1A16B06600301C0C /* MPParsedExpression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPParsedExpression.h; sourceTree = ""; }; + 3BEFF7501A16B06600301C0C /* MPParsedExpression.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPParsedExpression.m; sourceTree = ""; }; + 3BEFF7531A17AA3200301C0C /* MPProductTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPProductTerm.h; sourceTree = ""; }; + 3BEFF7541A17AA3200301C0C /* MPProductTerm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPProductTerm.m; sourceTree = ""; }; + 3BEFF7601A1804AF00301C0C /* MPFactorialTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPFactorialTerm.h; sourceTree = ""; }; + 3BEFF7611A1804AF00301C0C /* MPFactorialTerm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPFactorialTerm.m; sourceTree = ""; }; + 3BEFF7641A18066300301C0C /* MPSumFunctionTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSumFunctionTerm.h; sourceTree = ""; }; + 3BEFF7651A18066300301C0C /* MPSumFunctionTerm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPSumFunctionTerm.m; sourceTree = ""; }; + 3BEFF7681A1807B000301C0C /* MPParenthesisTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPParenthesisTerm.h; sourceTree = ""; }; + 3BEFF7691A1807B000301C0C /* MPParenthesisTerm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPParenthesisTerm.m; sourceTree = ""; }; + 3BEFF76C1A18083C00301C0C /* MPPowerTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPowerTerm.h; sourceTree = ""; }; + 3BEFF76D1A18083C00301C0C /* MPPowerTerm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPowerTerm.m; sourceTree = ""; }; + 3BEFF7701A180C8800301C0C /* MPFractionTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPFractionTerm.h; sourceTree = ""; }; + 3BEFF7711A180C8800301C0C /* MPFractionTerm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPFractionTerm.m; sourceTree = ""; }; + 3BF54BB71A18D08400883BFA /* MPExpressionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPExpressionParser.h; sourceTree = ""; }; + 3BF54BB81A18D08400883BFA /* MPExpressionParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPExpressionParser.m; sourceTree = ""; }; 3BF59AFB19D80ECC00E54292 /* MPFunctionsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPFunctionsViewController.h; sourceTree = ""; }; 3BF59AFC19D80ECC00E54292 /* MPFunctionsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPFunctionsViewController.m; sourceTree = ""; }; 3BF59AFD19D80ECC00E54292 /* MPFunctionsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MPFunctionsViewController.xib; sourceTree = ""; }; @@ -325,38 +323,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 3B69B68219E6E8A50028E608 /* Expression Tree */ = { - isa = PBXGroup; - children = ( - 3B69B68F19E6ED6E0028E608 /* MPExpressionTreeElement.h */, - 3B69B68319E6E8B20028E608 /* MPExpressionTree.h */, - 3B69B68419E6E8B20028E608 /* MPExpressionTree.m */, - 3B69B68719E6E9280028E608 /* MPSummand.h */, - 3B69B68819E6E9280028E608 /* MPSummand.m */, - 3B69B6C319E95B250028E608 /* MPOperatorChain.h */, - 3B69B6C419E95B250028E608 /* MPOperatorChain.m */, - 3B69B68B19E6EB0D0028E608 /* MPProduct.h */, - 3B69B68C19E6EB0D0028E608 /* MPProduct.m */, - 3B69B6AF19E8175F0028E608 /* MPFactor.h */, - 3B69B6B019E8175F0028E608 /* MPFactor.m */, - 3B69B69519E6F0780028E608 /* MPValueGroup.h */, - 3B69B69619E6F0780028E608 /* MPValueGroup.m */, - 3B69B69B19E6F2110028E608 /* MPNumber.h */, - 3B69B69C19E6F2110028E608 /* MPNumber.m */, - 3B69B69F19E6F2420028E608 /* MPVariable.h */, - 3B69B6A019E6F2420028E608 /* MPVariable.m */, - 3B69B6A719E6F2AF0028E608 /* MPFunction+MPValue.h */, - 3B69B6A819E6F2AF0028E608 /* MPFunction+MPValue.m */, - 3B69B6BB19E948740028E608 /* MPFunctionValue.h */, - 3B69B6BC19E948740028E608 /* MPFunctionValue.m */, - 3B69B6B319E88E750028E608 /* MPUnexpectedSymbolValue.h */, - 3B69B6B419E88E750028E608 /* MPUnexpectedSymbolValue.m */, - 3B69B6BF19E953590028E608 /* MPFactorial.h */, - 3B69B6C019E953590028E608 /* MPFactorial.m */, - ); - name = "Expression Tree"; - sourceTree = ""; - }; 3B7172E519C7112C00FEAA5B /* Resources */ = { isa = PBXGroup; children = ( @@ -423,8 +389,6 @@ isa = PBXGroup; children = ( 3BC46B4B19B38CB60033F13A /* Base Expression Classes */, - 3B69B68219E6E8A50028E608 /* Expression Tree */, - 3BB09EBC1905EF210080A5ED /* Functions */, 3B87E35B1900933200259938 /* MPRangePath.h */, 3B87E35C1900933200259938 /* MPRangePath.m */, 3BC46B4D19B38CFB0033F13A /* Helpers */, @@ -455,8 +419,6 @@ 3B5FF73A19DB2FF500C8348A /* MPPowerFunction.m */, 3B69B67A19E4915E0028E608 /* MPFractionFunction.h */, 3B69B67B19E4915E0028E608 /* MPFractionFunction.m */, - 3B3A4AAC19F71855001E9D54 /* MPRootFunction.h */, - 3B3A4AAD19F71855001E9D54 /* MPRootFunction.m */, ); name = Functions; sourceTree = ""; @@ -492,8 +454,6 @@ 3B69B66B19DB41B90028E608 /* MPPowerFunctionLayout.m */, 3B69B67E19E493630028E608 /* MPFractionFunctionLayout.h */, 3B69B67F19E493630028E608 /* MPFractionFunctionLayout.m */, - 3B3A4AB019F71A11001E9D54 /* MPRootFunctionLayout.h */, - 3B3A4AB119F71A11001E9D54 /* MPRootFunctionLayout.m */, ); name = "Function Layouts"; sourceTree = ""; @@ -517,8 +477,6 @@ 3BFAC39B1997BC7600B3EF67 /* NSString+MPExpressionElement.m */, 3B87E35E19009D5F00259938 /* MPFunction.h */, 3B87E35F19009D5F00259938 /* MPFunction.m */, - 3B69B6B719E935E20028E608 /* MPSuffixFunction.h */, - 3B69B6B819E935E20028E608 /* MPSuffixFunction.m */, 3B7B3A1619CC44E4005849E5 /* MPExpressionTokenizer.h */, 3B7B3A1719CC44E4005849E5 /* MPExpressionTokenizer.m */, 3B7B3A2A19CC467E005849E5 /* MPToken.h */, @@ -527,6 +485,7 @@ 3B7B3A5319CC50B1005849E5 /* MPFunction+MPToken.m */, 3BB18AA319CDB3A900986DA0 /* MPTokenStream.h */, 3BB18AA419CDB3A900986DA0 /* MPTokenStream.m */, + 3BB09EBC1905EF210080A5ED /* Functions */, 3BC46B4F19B506F20033F13A /* Evaluation */, ); name = "Base Expression Classes"; @@ -546,14 +505,52 @@ 3BC46B4F19B506F20033F13A /* Evaluation */ = { isa = PBXGroup; children = ( + 3BF54BB71A18D08400883BFA /* MPExpressionParser.h */, + 3BF54BB81A18D08400883BFA /* MPExpressionParser.m */, + 3BEFF74F1A16B06600301C0C /* MPParsedExpression.h */, + 3BEFF7501A16B06600301C0C /* MPParsedExpression.m */, + 3BCA0C7E1A12619500C9E3E0 /* MPTerm.h */, + 3BCA0C7F1A12619500C9E3E0 /* MPTerm.m */, + 3B9265C51A2147DF00AD2809 /* MPNegatedTerm.h */, + 3B9265C61A2147DF00AD2809 /* MPNegatedTerm.m */, + 3BEFF74B1A16A4DA00301C0C /* MPSumTerm.h */, + 3BEFF74C1A16A4DA00301C0C /* MPSumTerm.m */, + 3BEFF7531A17AA3200301C0C /* MPProductTerm.h */, + 3BEFF7541A17AA3200301C0C /* MPProductTerm.m */, + 3BEFF7601A1804AF00301C0C /* MPFactorialTerm.h */, + 3BEFF7611A1804AF00301C0C /* MPFactorialTerm.m */, + 3B69B6BB19E948740028E608 /* MPElementaryFunctionTerm.h */, + 3B69B6BC19E948740028E608 /* MPElementaryFunctionTerm.m */, + 3B69B69B19E6F2110028E608 /* MPNumber.h */, + 3B69B69C19E6F2110028E608 /* MPNumber.m */, + 3B69B69F19E6F2420028E608 /* MPVariable.h */, + 3B69B6A019E6F2420028E608 /* MPVariable.m */, + 3BCA0C831A1405C000C9E3E0 /* MPFunctionTerm.h */, + 3BCA0C841A1405C000C9E3E0 /* MPFunctionTerm.m */, 3B78C85219C2DA5300516335 /* MPEvaluationContext.h */, 3B78C85319C2DA5300516335 /* MPEvaluationContext.m */, 3B591BB919C58D000061D86B /* MPMathRules.h */, 3B591BBA19C58D000061D86B /* MPMathRules.m */, + 3BEFF75F1A17FF5C00301C0C /* Functions */, ); name = Evaluation; sourceTree = ""; }; + 3BEFF75F1A17FF5C00301C0C /* Functions */ = { + isa = PBXGroup; + children = ( + 3BEFF7641A18066300301C0C /* MPSumFunctionTerm.h */, + 3BEFF7651A18066300301C0C /* MPSumFunctionTerm.m */, + 3BEFF7681A1807B000301C0C /* MPParenthesisTerm.h */, + 3BEFF7691A1807B000301C0C /* MPParenthesisTerm.m */, + 3BEFF76C1A18083C00301C0C /* MPPowerTerm.h */, + 3BEFF76D1A18083C00301C0C /* MPPowerTerm.m */, + 3BEFF7701A180C8800301C0C /* MPFractionTerm.h */, + 3BEFF7711A180C8800301C0C /* MPFractionTerm.m */, + ); + name = Functions; + sourceTree = ""; + }; 3BF9976218DE623E009CF6C4 = { isa = PBXGroup; children = ( @@ -647,47 +644,46 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 3B69B6C519E95B250028E608 /* MPOperatorChain.h in Headers */, 3B85834C19BB661100D76A8D /* MathKit.h in Headers */, + 3BEFF76E1A18083C00301C0C /* MPPowerTerm.h in Headers */, 3B85833819BB63BD00D76A8D /* MPExpression.h in Headers */, 3B85833919BB63C500D76A8D /* MPExpressionElement.h in Headers */, - 3B69B68D19E6EB0D0028E608 /* MPProduct.h in Headers */, - 3B69B6B919E935E20028E608 /* MPSuffixFunction.h in Headers */, 3B69B67C19E4915E0028E608 /* MPFractionFunction.h in Headers */, + 3BEFF7551A17AA3200301C0C /* MPProductTerm.h in Headers */, 3B78C85419C2DA5300516335 /* MPEvaluationContext.h in Headers */, 3B85834419BB654D00D76A8D /* NSString+MPExpressionElement.h in Headers */, - 3B3A4AAE19F71855001E9D54 /* MPRootFunction.h in Headers */, - 3B69B6B519E88E750028E608 /* MPUnexpectedSymbolValue.h in Headers */, + 3BCA0C851A1405C000C9E3E0 /* MPFunctionTerm.h in Headers */, 3B7172F219C9FC6700FEAA5B /* MPParenthesisFunctionLayout.h in Headers */, 3B52CEDC19BEE63000CEDCFC /* NSRegularExpression+MPParsingAdditions.h in Headers */, + 3BEFF76A1A1807B000301C0C /* MPParenthesisTerm.h in Headers */, 3B85833A19BB63D400D76A8D /* MPFunction.h in Headers */, - 3B69B6B119E8175F0028E608 /* MPFactor.h in Headers */, 3B69B66C19DB41B90028E608 /* MPPowerFunctionLayout.h in Headers */, - 3B69B69719E6F0780028E608 /* MPValueGroup.h in Headers */, - 3B3A4AB219F71A11001E9D54 /* MPRootFunctionLayout.h in Headers */, 3B85834319BB653700D76A8D /* MPSumFunction.h in Headers */, + 3BCA0C801A12619500C9E3E0 /* MPTerm.h in Headers */, 3B85834119BB651E00D76A8D /* MPRangePath.h in Headers */, - 3B69B6C119E953590028E608 /* MPFactorial.h in Headers */, 3B69B69D19E6F2110028E608 /* MPNumber.h in Headers */, 3B85834519BB655200D76A8D /* NSIndexPath+MPAdditions.h in Headers */, 3B5FF73B19DB2FF500C8348A /* MPPowerFunction.h in Headers */, 3B7172EE19C9FA8E00FEAA5B /* MPParenthesisFunction.h in Headers */, + 3BF54BB91A18D08400883BFA /* MPExpressionParser.h in Headers */, + 3BEFF7511A16B06600301C0C /* MPParsedExpression.h in Headers */, + 3BEFF7721A180C8800301C0C /* MPFractionTerm.h in Headers */, 3B85834619BB655C00D76A8D /* MPExpressionView.h in Headers */, 3B85834719BB655F00D76A8D /* MPExpressionStorage.h in Headers */, + 3B9265C71A2147DF00AD2809 /* MPNegatedTerm.h in Headers */, 3BB18AA519CDB3A900986DA0 /* MPTokenStream.h in Headers */, 3BF59AFE19D80ECC00E54292 /* MPFunctionsViewController.h in Headers */, 3B7B3A2C19CC467E005849E5 /* MPToken.h in Headers */, - 3B69B68919E6E9280028E608 /* MPSummand.h in Headers */, 3B7B3A1819CC44E4005849E5 /* MPExpressionTokenizer.h in Headers */, - 3B69B69019E6ED6E0028E608 /* MPExpressionTreeElement.h in Headers */, 3BF59B0319D81EE600E54292 /* MPWhiteView.h in Headers */, 3B85834819BB65B600D76A8D /* MPLayout.h in Headers */, - 3B69B6A919E6F2AF0028E608 /* MPFunction+MPValue.h in Headers */, - 3B69B68519E6E8B20028E608 /* MPExpressionTree.h in Headers */, + 3BEFF7661A18066300301C0C /* MPSumFunctionTerm.h in Headers */, 3B85834919BB65B600D76A8D /* MPExpressionLayout.h in Headers */, + 3BEFF7621A1804AF00301C0C /* MPFactorialTerm.h in Headers */, 3B7B3A5419CC50B1005849E5 /* MPFunction+MPToken.h in Headers */, - 3B69B6BD19E948740028E608 /* MPFunctionValue.h in Headers */, + 3B69B6BD19E948740028E608 /* MPElementaryFunctionTerm.h in Headers */, 3B591BBB19C58D000061D86B /* MPMathRules.h in Headers */, + 3BEFF74D1A16A4DA00301C0C /* MPSumTerm.h in Headers */, 3B69B68019E493630028E608 /* MPFractionFunctionLayout.h in Headers */, 3B69B6A119E6F2420028E608 /* MPVariable.h in Headers */, 3B85834A19BB65B600D76A8D /* MPFunctionLayout.h in Headers */, @@ -859,47 +855,47 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3BEFF76F1A18083C00301C0C /* MPPowerTerm.m in Sources */, 3B5FF73C19DB2FF500C8348A /* MPPowerFunction.m in Sources */, 3BBEA94219BB79A700133766 /* MPExpressionLayout.m in Sources */, + 3BF54BBA1A18D08400883BFA /* MPExpressionParser.m in Sources */, 3B7B3A1919CC44E4005849E5 /* MPExpressionTokenizer.m in Sources */, 3B591BBC19C58D000061D86B /* MPMathRules.m in Sources */, - 3B69B6BE19E948740028E608 /* MPFunctionValue.m in Sources */, + 3B69B6BE19E948740028E608 /* MPElementaryFunctionTerm.m in Sources */, 3B7172EF19C9FA8E00FEAA5B /* MPParenthesisFunction.m in Sources */, 3B7B3A5519CC50B1005849E5 /* MPFunction+MPToken.m in Sources */, + 3B9265C81A2147DF00AD2809 /* MPNegatedTerm.m in Sources */, 3BBEA94119BB79A700133766 /* MPLayout.m in Sources */, - 3B69B6B219E8175F0028E608 /* MPFactor.m in Sources */, - 3B69B6BA19E935E20028E608 /* MPSuffixFunction.m in Sources */, 3BBEA93D19BB79A700133766 /* NSString+MPExpressionElement.m in Sources */, 3B69B68119E493630028E608 /* MPFractionFunctionLayout.m in Sources */, - 3B69B68619E6E8B20028E608 /* MPExpressionTree.m in Sources */, 3BF59B0419D81EE600E54292 /* MPWhiteView.m in Sources */, 3BBEA94019BB79A700133766 /* MPExpressionStorage.m in Sources */, 3BBEA93F19BB79A700133766 /* MPExpressionView.m in Sources */, - 3B69B6AA19E6F2AF0028E608 /* MPFunction+MPValue.m in Sources */, 3B7B3A2D19CC467E005849E5 /* MPToken.m in Sources */, - 3B69B6C619E95B250028E608 /* MPOperatorChain.m in Sources */, 3B78C85519C2DA5300516335 /* MPEvaluationContext.m in Sources */, 3B69B6A219E6F2420028E608 /* MPVariable.m in Sources */, - 3B69B69819E6F0780028E608 /* MPValueGroup.m in Sources */, 3BBEA94419BB79A700133766 /* MPSumFunctionLayout.m in Sources */, - 3B69B6C219E953590028E608 /* MPFactorial.m in Sources */, 3B69B69E19E6F2110028E608 /* MPNumber.m in Sources */, + 3BEFF7521A16B06600301C0C /* MPParsedExpression.m in Sources */, 3B7172F319C9FC6700FEAA5B /* MPParenthesisFunctionLayout.m in Sources */, - 3B3A4AB319F71A11001E9D54 /* MPRootFunctionLayout.m in Sources */, + 3BEFF76B1A1807B000301C0C /* MPParenthesisTerm.m in Sources */, + 3BEFF7631A1804AF00301C0C /* MPFactorialTerm.m in Sources */, + 3BEFF7731A180C8800301C0C /* MPFractionTerm.m in Sources */, + 3BEFF7671A18066300301C0C /* MPSumFunctionTerm.m in Sources */, 3BBEA93A19BB79A700133766 /* MPSumFunction.m in Sources */, 3BBEA93E19BB79A700133766 /* NSIndexPath+MPAdditions.m in Sources */, 3B52CEDD19BEE63000CEDCFC /* NSRegularExpression+MPParsingAdditions.m in Sources */, + 3BEFF7561A17AA3200301C0C /* MPProductTerm.m in Sources */, 3B69B67D19E4915E0028E608 /* MPFractionFunction.m in Sources */, - 3B69B68E19E6EB0D0028E608 /* MPProduct.m in Sources */, - 3B69B6B619E88E750028E608 /* MPUnexpectedSymbolValue.m in Sources */, + 3BEFF74E1A16A4DA00301C0C /* MPSumTerm.m in Sources */, 3BF59AFF19D80ECC00E54292 /* MPFunctionsViewController.m in Sources */, + 3BCA0C861A1405C000C9E3E0 /* MPFunctionTerm.m in Sources */, 3BB18AA619CDB3A900986DA0 /* MPTokenStream.m in Sources */, + 3BCA0C811A12619500C9E3E0 /* MPTerm.m in Sources */, 3B69B66D19DB41B90028E608 /* MPPowerFunctionLayout.m in Sources */, 3BBEA93619BB79A700133766 /* MPFunction.m in Sources */, - 3B3A4AAF19F71855001E9D54 /* MPRootFunction.m in Sources */, 3BBEA93519BB79A700133766 /* MPExpression.m in Sources */, 3BBEA93B19BB79A700133766 /* MPRangePath.m in Sources */, - 3B69B68A19E6E9280028E608 /* MPSummand.m in Sources */, 3BBEA94319BB79A700133766 /* MPFunctionLayout.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/MathPad/Base.lproj/MainMenu.xib b/MathPad/Base.lproj/MainMenu.xib index 9852a38..90d7a26 100644 --- a/MathPad/Base.lproj/MainMenu.xib +++ b/MathPad/Base.lproj/MainMenu.xib @@ -1,7 +1,8 @@ - + - + + diff --git a/MathPad/MPExpressionTree.h b/MathPad/MPExpressionTree.h deleted file mode 100644 index cccba4c..0000000 --- a/MathPad/MPExpressionTree.h +++ /dev/null @@ -1,79 +0,0 @@ -// -// MPExpressionTree.h -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPExpressionTreeElement.h" - - - -@class MPExpressionTree; - - -/*! - @class MPExpressionTree - @brief The @c MPExpressionTree class is the main interface for working - with the mathematical representation of an expression. - - @discussion Expressions are represented as a tree structure of elements (all - of which must conform to the @c MPExpressionTreeElement - protocol). Most messages sent to instances of the @c - MPExpressionTree class are cascaded down different parts of an - expression in some way. - */ -@interface MPExpressionTree : NSObject - -/*! - @property definedVariable - @brief The variable this expression defines. - - @discussion A variable definition must be at the beginning of an expression. - If it defines a variable it must start with a single letter - followed by an equals sign. The single letter is the name of the - variable that is defined. - */ -@property (nonatomic, copy) NSString *definedVariable; - - -/*! - @property summands - @brief The summands that make up the receiver. - - @discussion A expression mathematically can be interpreted as a series of - summands. Summands are the different pars of an expression that - are separated by + or - symbols. Every object in the returned - array is guaranteed to conform to the @c MPExpressionTreeElement - protocol. - */ -@property (readonly, nonatomic, strong) NSArray *summands; - - -/*! - @method validateExpectingVariableDefinition:error: - @brief Validates the receiver. - - @discussion Using this method you can validate an expression that contains a - variable definition. If a variable definition is expected but not - found this method returns @c NO. Likewise @c NO is returned if - you do not expect a variable definition but one is found. - - @param flag - Specifies wether or not to expect a variable definition at the - beginning of the expression. - - @param error - If there is a syntax error in the receiver this parameter will be - set to an appropriate value. If you are not interested in the - type of syntax error pass @c NULL. - - @return @c YES if the receiver is valid, @c NO otherwise. If @c NO is - returned the @c error parameter should be set to an appropriate - value. - */ -- (BOOL)validateExpectingVariableDefinition:(BOOL)flag - error:(NSError *__autoreleasing *)error; - -@end diff --git a/MathPad/MPExpressionTree.m b/MathPad/MPExpressionTree.m deleted file mode 100644 index cacd4e3..0000000 --- a/MathPad/MPExpressionTree.m +++ /dev/null @@ -1,125 +0,0 @@ -// -// MPExpressionTree.m -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPExpressionTree.h" - -#import "MPSummand.h" - -#import "MPTokenStream.h" -#import "MPToken.h" - -#import "MPExpression.h" - - - -@implementation MPExpressionTree { - NSMutableArray *_summands; -} - -- (id)init -{ - self = [super init]; - if (self) { - _summands = [[NSMutableArray alloc] init]; - } - return self; -} - - -- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream -{ - self = [self init]; - if (self) { - [tokenStream beginIgnoringWhitespaceTokens]; - - self.definedVariable = nil; - if (tokenStream.currentToken.tokenType == MPVariableToken) { - if (tokenStream.peekNextToken.tokenType == MPEqualsToken) { - self.definedVariable = tokenStream.currentToken.stringValue; - [tokenStream currentTokenConsumed]; - [tokenStream currentTokenConsumed]; - } - } - while ([tokenStream hasMoreTokens]) { - [_summands addObject:[[MPSummand alloc] initWithTokenStream:tokenStream]]; - } - - [tokenStream endIgnoringOrAcceptingWhitespaceTokens]; - } - return self; -} - - -- (NSArray *)summands -{ - return _summands; -} - - -- (BOOL)validate:(NSError *__autoreleasing *)error -{ - return [self validateExpectingVariableDefinition:NO - error:error]; -} - - -- (BOOL)validateExpectingVariableDefinition:(BOOL)flag - error:(NSError *__autoreleasing *)error -{ - if (flag) { - if (!self.definedVariable) { - if (error) { - *error = MPParseError(1, - NSLocalizedString(@"Expected Variable Definition.", @"Error message. This is displayed when an expected variable definition was not found."), - nil); - } - return NO; - } - } else { - if (self.definedVariable) { - if (error) { - *error = MPParseError(2, - NSLocalizedString(@"Unexpected Variable Definition.", @"Error message. This is displayed when no variable definition was expected but one was found."), - nil); - } - return NO; - } - } - if (_summands.count == 0) { - if (error) { - *error = MPParseError(3, - NSLocalizedString(@"Empty Expression.", @"Error message. This is displayed when the user tried to evaluate an empty expression."), - nil); - } - return NO; - } - for (MPSummand *summand in _summands) { - if (![summand validate:error]) { - return NO; - } - } - return YES; -} - - -- (NSDecimalNumber *)evaluate -{ - NSDecimalNumber *value = [NSDecimalNumber zero]; - for (MPSummand *summand in _summands) { - NSDecimalNumber *currentValue = [summand evaluate]; - if ([currentValue isEqualToNumber:[NSDecimalNumber notANumber]]) { - value = currentValue; - break; - } - value = [value decimalNumberByAdding:currentValue]; - } - return value; -} - - -@end diff --git a/MathPad/MPExpressionTreeElement.h b/MathPad/MPExpressionTreeElement.h deleted file mode 100644 index 28787bb..0000000 --- a/MathPad/MPExpressionTreeElement.h +++ /dev/null @@ -1,89 +0,0 @@ -// -// MPExpressionTreeElement.h -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// -// TODO: Replace internal inconsistency exception with something else - - - -@class MPTokenStream; - - -/*! - @protocol MPExpressionTreeElement - @brief This protocol defines the methods that are essential for dealing - with an expression in a mathematical context. - - @discussion Dealing with an expression in a mathematical context involves - anything from evaluation to transformation of expressions and - equations. - */ -@protocol MPExpressionTreeElement -@required - - -/*! - @method initWithTokenStream: - @brief Initializes the expression tree element from the given token - strem. - - @discussion This method consumes the tokens that make up this element. If the - token stream does not start with a token that is appropriate for - the initializied expression tree element a @c - NSInternalInconsistency exception is raised. - - @param tokenStream - The token stream the receiver is to be initialized from. - - @return A new instance. - */ -- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream; - - -/*! - @method validate: - @brief Validates the receiver. - - @discussion Validation should only check for syntax errors. Mathematical - errors like a division by @c 0 should be handled with in @c - -evaluate. - - @param error - If there is a syntax error in the receiver this parameter should - be set to an appropriate value. If you are not interested in the - type of syntax error pass @c NULL. - - @return @c YES if the receiver is valid, @c NO otherwise. If @c NO is - returned the @c error parameter should be set to an appropriate - value. - */ -- (BOOL)validate:(NSError *__autoreleasing *)error; - - -/*! - @method evaluate: - @brief Evaluates the receiver. - - @discussion Evaluation does not take syntax errors into account. Before this - method is called you must call @c validate: to make sure that the - reciever is valid for evaluation. The result of evaluation with - @c -validate: returning @c NO may be unexpected or evaluation may - completely fail. - - @param error - If any errors occur during evaluation (such as division by zero) - this parameter will be set to an appropriate value. If you are - not interested in errors pass @c NULL. - @warning This method is not responsible for syntax validation. Use @c - -validate: instead. - - @return The result of the evaluationa or @c nil or @c NaN if evaluation - fails. If evaluation fails the @c error parameter will be set to - an apporpriate value. - */ -- (NSDecimalNumber *)evaluate:(NSError *__autoreleasing *)error; - -@end diff --git a/MathPad/MPFactor.h b/MathPad/MPFactor.h deleted file mode 100644 index ad016d3..0000000 --- a/MathPad/MPFactor.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// MPFactor.h -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPExpressionTreeElement.h" - -@class MPFactor, MPOperatorChain; -@protocol MPValue; - -@interface MPFactor : NSObject - -@property (readonly, nonatomic) BOOL hasMultiplicationSymbol; -@property (readonly, nonatomic, strong) MPOperatorChain *operatorChain; -@property (readonly, nonatomic, strong) id value; - -@end diff --git a/MathPad/MPFactor.m b/MathPad/MPFactor.m deleted file mode 100644 index cca7b37..0000000 --- a/MathPad/MPFactor.m +++ /dev/null @@ -1,80 +0,0 @@ -// -// MPFactor.m -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPFactor.h" - -#import "MPOperatorChain.h" -#import "MPValueGroup.h" - -#import "MPTokenStream.h" -#import "MPToken.h" - -#import "MPExpression.h" -#import "MPMathRules.h" - -@implementation MPFactor { - BOOL _multiplicationSymbolPresent; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - - } - return self; -} - -- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream -{ - self = [self init]; - if (self) { - [tokenStream beginIgnoringWhitespaceTokens]; - MPToken *token = tokenStream.currentToken; - _multiplicationSymbolPresent = token.tokenType == MPMultiplicationSymbolToken; - if (_multiplicationSymbolPresent) { - [tokenStream currentTokenConsumed]; - } - if (tokenStream.currentToken.tokenType == MPOperatorListToken) { - _operatorChain = [[MPOperatorChain alloc] initWithTokenStream:tokenStream]; - } - MPValueGroup *valueGroup = [[MPValueGroup alloc] initWithTokenStream:tokenStream]; - _value = [tokenStream consumeSuffixesForValue:valueGroup]; - [tokenStream endIgnoringOrAcceptingWhitespaceTokens]; - } - return self; -} - -- (BOOL)hasMultiplicationSymbol -{ - return _multiplicationSymbolPresent; -} - -- (BOOL)validate:(NSError *__autoreleasing *)error -{ - if (self.operatorChain.numberOfOperators > [[MPMathRules sharedRules] maximumOperatorChainLengthInMultiplication]) { - if (error) { - *error = MPParseError(7, - NSLocalizedString(@"Too many operators in Multiplication.", @"Error message. This is displayed when there are too many operators between a multiplication symbol and a value."), - nil); - } - return NO; - } - return [self.value validate:error]; -} - -- (NSDecimalNumber *)evaluate -{ - NSDecimalNumber *value = [self.value evaluate]; - if ([value isNotEqualTo:[NSDecimalNumber notANumber]] && self.operatorChain) { - value = [value decimalNumberByMultiplyingBy:[self.operatorChain evaluate]]; - } - return value; -} - -@end diff --git a/MathPad/MPFactorial.h b/MathPad/MPFactorial.h deleted file mode 100644 index 6892404..0000000 --- a/MathPad/MPFactorial.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// MPFactorial.h -// MathPad -// -// Created by Kim Wittenburg on 11.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPValueGroup.h" - -@class MPFactorial; - -@interface MPFactorial : NSObject - -@property (readonly, nonatomic, strong) id value; - -@end diff --git a/MathPad/MPFactorial.m b/MathPad/MPFactorial.m deleted file mode 100644 index dbae67c..0000000 --- a/MathPad/MPFactorial.m +++ /dev/null @@ -1,51 +0,0 @@ -// -// MPFactorial.m -// MathPad -// -// Created by Kim Wittenburg on 11.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPFactorial.h" - -#import "MPTokenStream.h" -#import "MPToken.h" - -@implementation MPFactorial - -- (instancetype)init -{ - self = [super init]; - if (self) { - } - return self; -} - -- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream -{ - self = [self init]; - if (self) { - [tokenStream beginIgnoringWhitespaceTokens]; - if (tokenStream.currentToken.tokenType != MPFactorialToken) { - [tokenStream endIgnoringOrAcceptingWhitespaceTokens]; - return nil; - } else { - [tokenStream currentTokenConsumed]; - } - [tokenStream endIgnoringOrAcceptingWhitespaceTokens]; - } - return self; -} - -- (BOOL)validate:(NSError *__autoreleasing *)error -{ - return [self.value validate:error]; -} - -- (NSDecimalNumber *)evaluate -{ - double value = [self.value evaluate].doubleValue; - return [[NSDecimalNumber alloc] initWithDouble:tgamma(value+1)]; -} - -@end diff --git a/MathPad/MPFunction+MPValue.h b/MathPad/MPFunction+MPValue.h deleted file mode 100644 index 5e6d9fe..0000000 --- a/MathPad/MPFunction+MPValue.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// MPFunction+MPValue.h -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPFunction.h" -#import "MPValueGroup.h" - -@interface MPFunction (MPValue) - -@end diff --git a/MathPad/MPFunction+MPValue.m b/MathPad/MPFunction+MPValue.m deleted file mode 100644 index 87bf0ab..0000000 --- a/MathPad/MPFunction+MPValue.m +++ /dev/null @@ -1,28 +0,0 @@ -// -// MPFunction+MPValue.m -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPFunction+MPValue.h" - -#import "MPFunction+MPToken.h" - -@implementation MPFunction (MPValue) - -- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream -{ - [tokenStream beginIgnoringWhitespaceTokens]; - if (tokenStream.currentToken.tokenType != MPGenericFunctionToken) { - @throw [NSException exceptionWithName:NSInternalInconsistencyException - reason:@"Expected Function" - userInfo:nil]; - } - [tokenStream currentTokenConsumed]; - [tokenStream endIgnoringOrAcceptingWhitespaceTokens]; - return [self init]; -} - -@end diff --git a/MathPad/MPFunctionValue.h b/MathPad/MPFunctionValue.h deleted file mode 100644 index 8728d62..0000000 --- a/MathPad/MPFunctionValue.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// MPFunctionValue.h -// MathPad -// -// Created by Kim Wittenburg on 11.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPValueGroup.h" - -@class MPFunctionValue, MPPowerFunction, MPValueGroup; - -@interface MPFunctionValue : NSObject - -@property (readonly, nonatomic, copy) NSString *functionName; -@property (readonly, nonatomic, strong) MPPowerFunction *power; // May be nil -@property (readonly, nonatomic, strong) MPValueGroup *valueGroup; - -@end \ No newline at end of file diff --git a/MathPad/MPFunctionValue.m b/MathPad/MPFunctionValue.m deleted file mode 100644 index b0853dc..0000000 --- a/MathPad/MPFunctionValue.m +++ /dev/null @@ -1,145 +0,0 @@ -// -// MPFunctionValue.m -// MathPad -// -// Created by Kim Wittenburg on 11.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPFunctionValue.h" - -#import "MPTokenStream.h" -#import "MPToken.h" - -#import "MPExpression.h" -#import "MPMathRules.h" - -double defaultFunction(double value) {return value;}; - -@implementation MPFunctionValue { - NSDecimalNumber *(^_function)(NSDecimalNumber *); -} - -- (id)init -{ - self = [super init]; - if (self) { - - } - return self; -} - -- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream -{ - switch (tokenStream.currentToken.tokenType) { - case MPSinToken: - [tokenStream currentTokenConsumed]; - _functionName = @"sin"; - return [self initWithTokenStream:tokenStream - function:&sin - takesArcValue:YES - returnsArcValue:NO]; - - case MPCosToken: - [tokenStream currentTokenConsumed]; - _functionName = @"cos"; - return [self initWithTokenStream:tokenStream - function:&cos - takesArcValue:YES - returnsArcValue:NO]; - - case MPTanToken: - [tokenStream currentTokenConsumed]; - _functionName = @"tan"; - return [self initWithTokenStream:tokenStream - function:&tan - takesArcValue:YES - returnsArcValue:NO]; - - case MPASinToken: - [tokenStream currentTokenConsumed]; - _functionName = @"asin"; - return [self initWithTokenStream:tokenStream - function:&asin - takesArcValue:YES - returnsArcValue:NO]; - - case MPACosToken: - [tokenStream currentTokenConsumed]; - _functionName = @"acos"; - return [self initWithTokenStream:tokenStream - function:&acos - takesArcValue:YES - returnsArcValue:NO]; - - case MPATanToken: - [tokenStream currentTokenConsumed]; - _functionName = @"atan"; - return [self initWithTokenStream:tokenStream - function:&atan - takesArcValue:YES - returnsArcValue:NO]; - - default: - @throw [NSException exceptionWithName:NSInternalInconsistencyException - reason:@"Expected Function" - userInfo:nil]; - break; - } - return self; -} - -- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream - function:(double (*)(double))function - takesArcValue:(BOOL)takesArc - returnsArcValue:(BOOL)returnsArc -{ - self = [self init]; - if (self) { - _valueGroup = [[MPValueGroup alloc] initWithTokenStream:tokenStream]; - id __weak weakSelf = self; - _function = ^(NSDecimalNumber *value){ - if (takesArc) { - value = [weakSelf convertToRadiantsIfNecessary:value]; - } - NSDecimalNumber *returnValue = [[NSDecimalNumber alloc] initWithDouble:function(value.doubleValue)]; - if (returnsArc) { - returnValue = [weakSelf convertToDegreesIfNecessary:returnValue]; - } - return returnValue; - }; - } - return self; -} - -- (NSDecimalNumber *)convertToRadiantsIfNecessary:(NSDecimalNumber *)degrees -{ - if ([MPMathRules sharedRules].isUsingDegrees) { - // * M_PI / 180 - return [[degrees decimalNumberByMultiplyingBy:[[NSDecimalNumber alloc] initWithDouble:M_PI]] decimalNumberByDividingBy:[[NSDecimalNumber alloc] initWithInteger:180]]; - } else { - return degrees; - } -} - -- (NSDecimalNumber *)convertToDegreesIfNecessary:(NSDecimalNumber *)radiants -{ - if ([MPMathRules sharedRules].isUsingDegrees) { - // * 180 / M_PI - return [[radiants decimalNumberByMultiplyingBy:[[NSDecimalNumber alloc] initWithInteger:180]] decimalNumberByDividingBy:[[NSDecimalNumber alloc] initWithDouble:M_PI]]; - } else { - return radiants; - } -} - -- (BOOL)validate:(NSError *__autoreleasing *)error -{ - return [self.valueGroup validate:error]; -} - -- (NSDecimalNumber *)evaluate -{ - return _function([self.valueGroup evaluate]); -} - -@end diff --git a/MathPad/MPOperatorChain.h b/MathPad/MPOperatorChain.h deleted file mode 100644 index 1e911ca..0000000 --- a/MathPad/MPOperatorChain.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// MPOperatorChain.h -// MathPad -// -// Created by Kim Wittenburg on 11.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPExpressionTreeElement.h" - -@class MPOperatorChain; - -@interface MPOperatorChain : NSObject - -@property (readonly, nonatomic) BOOL negating; -@property (readonly, nonatomic) NSUInteger numberOfOperators; - -@end diff --git a/MathPad/MPOperatorChain.m b/MathPad/MPOperatorChain.m deleted file mode 100644 index b52209e..0000000 --- a/MathPad/MPOperatorChain.m +++ /dev/null @@ -1,61 +0,0 @@ -// -// MPOperatorChain.m -// MathPad -// -// Created by Kim Wittenburg on 11.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPOperatorChain.h" - -#import "MPTokenStream.h" -#import "MPToken.h" - -@implementation MPOperatorChain - -- (id)init -{ - self = [super init]; - if (self) { - } - return self; -} - -- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream -{ - self = [self init]; - if (self) { - [tokenStream beginIgnoringWhitespaceTokens]; - MPToken *currentToken = tokenStream.currentToken; - - if (currentToken.tokenType != MPOperatorListToken) { - @throw [NSException exceptionWithName:NSInternalInconsistencyException reason:@"Expected Operators" userInfo:nil]; - } - - NSString *operatorString = currentToken.stringValue; - operatorString = [[operatorString componentsSeparatedByString:@" "] componentsJoinedByString:@""]; - _negating = NO; - _numberOfOperators = operatorString.length; - for (NSUInteger index = 0; index < _numberOfOperators; index++) { - if ([[operatorString substringWithRange:NSMakeRange(index, 1)] isEqualToString:@"-"]) { - _negating = !_negating; - } - } - - [tokenStream currentTokenConsumed]; - [tokenStream endIgnoringOrAcceptingWhitespaceTokens]; - } - return self; -} - -- (BOOL)validate:(NSError *__autoreleasing *)error -{ - return YES; -} - -- (NSDecimalNumber *)evaluate -{ - return self.negating ? [[NSDecimalNumber alloc] initWithInteger:-1] : [NSDecimalNumber one]; -} - -@end diff --git a/MathPad/MPProduct.h b/MathPad/MPProduct.h deleted file mode 100644 index c43e029..0000000 --- a/MathPad/MPProduct.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// MPProduct.h -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPExpressionTreeElement.h" - -@class MPProduct; - -@interface MPProduct : NSObject - -@property (readonly, nonatomic, strong) NSArray *factors; - -@end diff --git a/MathPad/MPProduct.m b/MathPad/MPProduct.m deleted file mode 100644 index eacec83..0000000 --- a/MathPad/MPProduct.m +++ /dev/null @@ -1,99 +0,0 @@ -// -// MPProduct.m -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPProduct.h" - -#import "MPFactor.h" -#import "MPValueGroup.h" - -#import "MPTokenStream.h" -#import "MPToken.h" - -#import "MPExpression.h" - -@implementation MPProduct { - NSMutableArray *_factors; -} - -- (id)init -{ - self = [super init]; - if (self) { - _factors = [[NSMutableArray alloc] init]; - } - return self; -} - -- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream -{ - self = [self init]; - if (self) { - [tokenStream beginIgnoringWhitespaceTokens]; - - while ([tokenStream hasMoreTokens] && tokenStream.currentToken.tokenType != MPOperatorListToken) { - [_factors addObject:[[MPFactor alloc] initWithTokenStream:tokenStream]]; - } - [tokenStream endIgnoringOrAcceptingWhitespaceTokens]; - } - return self; -} - -- (NSArray *)factors -{ - return _factors; -} - -- (BOOL)validate:(NSError *__autoreleasing *)error -{ - if (_factors.count == 0) { - if (error) { - *error = MPParseError(5, - NSLocalizedString(@"Expected A Value.", @"Error message. Displayed when a value was expected in an expression but none was found."), - nil); - } - return NO; - } - MPFactor *factor = _factors[0]; - if (factor.hasMultiplicationSymbol) { - if (error) { - *error = MPParseError(6, - NSLocalizedString(@"Unexpected Symbol.", @"Error message. Displayed when or inappropriate symbol was encountered during parsing."), - nil); - } - return NO; - } - if (![factor.value validate:error]) { - return NO; - } - for (NSUInteger index = 1; index < _factors.count; index++) { - factor = _factors[index]; - if (![factor validate:error]) { - return NO; - } - } - return YES; -} - -- (NSDecimalNumber *)evaluate -{ - NSDecimalNumber *value = [NSDecimalNumber one]; - for (MPFactor *factor in _factors) { - NSDecimalNumber *currentValue = [factor evaluate]; - if ([currentValue isEqualToNumber:[NSDecimalNumber notANumber]]) { - value = currentValue; - break; - } - value = [value decimalNumberByMultiplyingBy:currentValue]; - if ([value compare:@(0)] == NSOrderedSame) { - break; - } - } - return value; -} - -@end diff --git a/MathPad/MPRootFunction.h b/MathPad/MPRootFunction.h deleted file mode 100644 index f932029..0000000 --- a/MathPad/MPRootFunction.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// MPRootFunction.h -// MathPad -// -// Created by Kim Wittenburg on 22.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPFunction.h" - -@class MPRootFunction, MPExpression; - -@interface MPRootFunction : MPFunction - -@property (nonatomic, strong) MPExpression *exponentExpression; -@property (nonatomic, strong) MPExpression *radicantExpression; - -@end diff --git a/MathPad/MPRootFunction.m b/MathPad/MPRootFunction.m deleted file mode 100644 index 3d4db2b..0000000 --- a/MathPad/MPRootFunction.m +++ /dev/null @@ -1,44 +0,0 @@ -// -// MPRootFunction.m -// MathPad -// -// Created by Kim Wittenburg on 22.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPRootFunction.h" - -#import "MPExpression.h" -#import "MPExpressionTree.h" - -@implementation MPRootFunction - -MPFunctionAccessorImplementation(ExponentExpression, _exponentExpression) -MPFunctionAccessorImplementation(RadicantExpression, _radicantExpression) - -- (NSArray *)childrenAccessors -{ - return @[@"exponentExpression", @"radicantExpression"]; -} - -- (BOOL)validate:(NSError *__autoreleasing *)error -{ - return [[self.exponentExpression parse] validate:error] && [[self.radicantExpression parse] validate:error]; -} - -- (NSDecimalNumber *)evaluate -{ - NSDecimalNumber *exponent = [[self.exponentExpression parse] evaluate]; - NSDecimalNumber *radicant = [[self.radicantExpression parse] evaluate]; - return [[NSDecimalNumber alloc] initWithDouble:pow(radicant.doubleValue, exponent.doubleValue)]; -} - -- (NSString *)description -{ - if (self.exponentExpression == nil) { - return [NSString stringWithFormat:@"√%@", self.radicantExpression.description]; - } - return [NSString stringWithFormat:@"pow(%@; %@)", self.radicantExpression.description, self.exponentExpression]; -} - -@end diff --git a/MathPad/MPRootFunctionLayout.h b/MathPad/MPRootFunctionLayout.h deleted file mode 100644 index 5e8fef8..0000000 --- a/MathPad/MPRootFunctionLayout.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// MPRootFunctionLayout.h -// MathPad -// -// Created by Kim Wittenburg on 22.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPFunctionLayout.h" - -@class MPRootFunctionLayout, MPRootFunction; - -@interface MPRootFunctionLayout : MPFunctionLayout - -- (MPRootFunction *)rootFunction; - -@property (nonatomic, getter=isExponentImplicit) BOOL exponentImplicit; - -@end diff --git a/MathPad/MPRootFunctionLayout.m b/MathPad/MPRootFunctionLayout.m deleted file mode 100644 index 48941fd..0000000 --- a/MathPad/MPRootFunctionLayout.m +++ /dev/null @@ -1,84 +0,0 @@ -// -// MPRootFunctionLayout.m -// MathPad -// -// Created by Kim Wittenburg on 22.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPRootFunctionLayout.h" - -#import "MPRootFunction.h" - -#define kRootFunctionSpaceBetweenRadicantAndExponent 5 - -@implementation MPRootFunctionLayout - -- (MPRootFunction *)rootFunction -{ - return (MPRootFunction *)self.function; -} - -- (NSUInteger)indexOfLeadingChild -{ - return 0; -} - -- (NSUInteger)indexOfTrailingChild -{ - return 1; -} - -- (NSUInteger)indexOfChildAfterChildAtIndex:(NSUInteger)index -{ - return index == 0 ? 1 : [super indexOfChildAfterChildAtIndex:index]; -} - -- (NSUInteger)indexOfChildBeforeChildAtIndex:(NSUInteger)index -{ - return index == 1 ? 0 : [super indexOfChildBeforeChildAtIndex:index]; -} - -- (NSUInteger)indexOfChildBelowChildAtIndex:(NSUInteger)index -{ - return 1; -} - -- (NSUInteger)indexOfChildAboveChildAtIndex:(NSUInteger)index -{ - return 0; -} - -- (NSIndexSet *)indexesOfRemainingChildren -{ - return [NSIndexSet indexSetWithIndex:1]; -} - -- (NSPoint)offsetOfChildLayoutAtIndex:(NSUInteger)index -{ - NSRect exponentBounds = [self childLayoutAtIndex:0].bounds; - NSRect radicandBounds = [self childLayoutAtIndex:1].bounds; - if (index == 0) { - return NSMakePoint(0, (radicandBounds.size.height + radicandBounds.origin.y) / 2); - } else { - - return NSMakePoint(exponentBounds.size.width + kRootFunctionSpaceBetweenRadicantAndExponent, 0); - } -} - -- (BOOL)childAtIndexUsesSmallSize:(NSUInteger)index -{ - return index == 0; -} - -- (NSRect)generateBounds -{ - return NSZeroRect; -} - -- (void)draw -{ - -} - -@end diff --git a/MathPad/MPSuffixFunction.h b/MathPad/MPSuffixFunction.h deleted file mode 100644 index e2c7f34..0000000 --- a/MathPad/MPSuffixFunction.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// MPSuffixFunction.h -// MathPad -// -// Created by Kim Wittenburg on 11.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPFunction.h" - - - -@class MPSuffixFunction; -@protocol MPValue; - - -/*! - @class MPSuffixFunction - @brief This is the common superclass for all functions that apply to the - value preceeding them. - - @discussion One example for a suffix function is a power. Powers apply to a - base value and are evaluated with very high priority. In fact the - base value may not be used without previously having evaluated - the suffix function. - - Another special thing about suffix functions is that they need to - know more than their own children (namely the base value) to be - evaluated. To be able to do this suffix functions have a special - property @c baseValue that is set before the function is - evaluated. - */ -@interface MPSuffixFunction : MPFunction - -/*! - @property baseValue - @brief The receiver's base value. - - @discussion The base value is the thing a suffix function applies to (e.g. - a power's base). - */ -@property (nonatomic, strong) id baseValue; - -@end diff --git a/MathPad/MPSuffixFunction.m b/MathPad/MPSuffixFunction.m deleted file mode 100644 index 85401cf..0000000 --- a/MathPad/MPSuffixFunction.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// MPSuffixFunction.m -// MathPad -// -// Created by Kim Wittenburg on 11.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPSuffixFunction.h" - - - -@implementation MPSuffixFunction - -@end diff --git a/MathPad/MPSummand.h b/MathPad/MPSummand.h deleted file mode 100644 index 14a3a20..0000000 --- a/MathPad/MPSummand.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// MPSummand.h -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPExpressionTreeElement.h" - - - -@class MPSummand, MPOperatorChain, MPProduct; - - -/*! - @class MPSummand - @brief A summand is a part of an expression that consists of a list of - addition and subtraction operators and a product. - */ -@interface MPSummand : NSObject - - -/*! - @property operatorChain - @brief The summand's preceeding operators. - - @discussion The operator chain is interpreted as a factor for the @c product - property of the summand during evaluation. - */ -@property (readonly, nonatomic, strong) MPOperatorChain *operatorChain; - - -/*! - @property product - @brief The summand's product. - - @discussion The product is the @em value of a summand. - */ -@property (readonly, nonatomic, strong) MPProduct *product; - -@end diff --git a/MathPad/MPSummand.m b/MathPad/MPSummand.m deleted file mode 100644 index eb3126a..0000000 --- a/MathPad/MPSummand.m +++ /dev/null @@ -1,66 +0,0 @@ -// -// MPSummand.m -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPSummand.h" - -#import "MPOperatorChain.h" -#import "MPProduct.h" - -#import "MPTokenStream.h" -#import "MPToken.h" - -#import "MPExpression.h" -#import "MPMathRules.h" - -@implementation MPSummand - -- (id)init -{ - self = [super init]; - if (self) { - } - return self; -} - -- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream -{ - self = [self init]; - if (self) { - [tokenStream beginIgnoringWhitespaceTokens]; - if (tokenStream.currentToken.tokenType == MPOperatorListToken) { - _operatorChain = [[MPOperatorChain alloc] initWithTokenStream:tokenStream]; - } - _product = [[MPProduct alloc] initWithTokenStream:tokenStream]; - [tokenStream endIgnoringOrAcceptingWhitespaceTokens]; - } - return self; -} - -- (BOOL)validate:(NSError *__autoreleasing *)error -{ - if (self.operatorChain.numberOfOperators > [MPMathRules sharedRules].maximumOperatorChainLength) { - if (error) { - *error = MPParseError(4, - NSLocalizedString(@"Too many operators.", @"Error message. This is displayed when there are too many subsequent operators in an expression."), - nil); - } - return NO; - } - return [self.product validate:error]; -} - -- (NSDecimalNumber *)evaluate -{ - NSDecimalNumber *value = [self.product evaluate]; - if ([value isNotEqualTo:[NSDecimalNumber notANumber]] && self.operatorChain) { - value = [value decimalNumberByMultiplyingBy:[self.operatorChain evaluate]]; - } - return value; -} - -@end diff --git a/MathPad/MPUnexpectedSymbolValue.h b/MathPad/MPUnexpectedSymbolValue.h deleted file mode 100644 index 708178e..0000000 --- a/MathPad/MPUnexpectedSymbolValue.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// MPUnidentifiedSymbolValue.h -// MathPad -// -// Created by Kim Wittenburg on 11.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPValueGroup.h" - -@class MPUnexpectedSymbolValue; - -@interface MPUnexpectedSymbolValue : NSObject - -@property (readonly, nonatomic, copy) NSString *symbol; - -@end diff --git a/MathPad/MPUnexpectedSymbolValue.m b/MathPad/MPUnexpectedSymbolValue.m deleted file mode 100644 index 87ae1ce..0000000 --- a/MathPad/MPUnexpectedSymbolValue.m +++ /dev/null @@ -1,58 +0,0 @@ -// -// MPUnidentifiedSymbolValue.m -// MathPad -// -// Created by Kim Wittenburg on 11.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPUnexpectedSymbolValue.h" - -#import "MPTokenStream.h" -#import "MPToken.h" - -#import "MPExpression.h" - -@implementation MPUnexpectedSymbolValue - -- (instancetype)init -{ - self = [super init]; - if (self) { - } - return self; -} - -- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream -{ - self = [self init]; - if (self) { - [tokenStream beginIgnoringWhitespaceTokens]; - _symbol = tokenStream.currentToken.stringValue; - [tokenStream currentTokenConsumed]; - [tokenStream endIgnoringOrAcceptingWhitespaceTokens]; - } - return self; -} - -- (BOOL)validate:(NSError *__autoreleasing *)error -{ - if (error) { - *error = MPParseError(10, - NSLocalizedString(@"Unknown Symbol.", @"Error message. Displayed when an unknown symbol was encountered during parsing."), - nil); - } - return NO; -} - -- (NSDecimalNumber *)evaluate -{ - return [NSDecimalNumber notANumber]; -} - -- (NSArray *)expressionElements -{ - return @[self.symbol]; -} - -@end diff --git a/MathPad/MPValueGroup.h b/MathPad/MPValueGroup.h deleted file mode 100644 index 2dcabfb..0000000 --- a/MathPad/MPValueGroup.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// MPValueGroup.h -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPExpressionTreeElement.h" -#import "MPTokenStream.h" - -@class MPValueGroup; -@protocol MPValue; - -@protocol MPValue - -@end - - -@interface MPValueGroup : NSObject - -@property (readonly, nonatomic, strong) NSArray *values; - -@end - - -@interface MPTokenStream (MPValueSuffixes) - -- (id)consumeSuffixesForValue:(id)value; - -@end \ No newline at end of file diff --git a/MathPad/MPValueGroup.m b/MathPad/MPValueGroup.m deleted file mode 100644 index 40b2379..0000000 --- a/MathPad/MPValueGroup.m +++ /dev/null @@ -1,162 +0,0 @@ -// -// MPValueGroup.m -// MathPad -// -// Created by Kim Wittenburg on 09.10.14. -// Copyright (c) 2014 Kim Wittenburg. All rights reserved. -// - -#import "MPValueGroup.h" - -#import "MPNumber.h" -#import "MPVariable.h" -#import "MPFunctionValue.h" -#import "MPUnexpectedSymbolValue.h" -#import "MPFactorial.h" - -#import "MPTokenStream.h" -#import "MPToken.h" - -#import "MPExpression.h" -#import "MPSuffixFunction.h" - -@implementation MPValueGroup { - NSMutableArray *_values; -} - -- (id)init -{ - self = [super init]; - if (self) { - _values = [[NSMutableArray alloc] init]; - } - return self; -} - -- (instancetype)initWithTokenStream:(MPTokenStream *)tokenStream -{ - self = [self init]; - if (self) { - [tokenStream beginIgnoringWhitespaceTokens]; - [tokenStream currentToken]; // This will skip leading whitespaces - [tokenStream endIgnoringOrAcceptingWhitespaceTokens]; - [tokenStream beginAcceptingWhitespaceTokens]; - - BOOL checkMoreTokens = YES; - while (tokenStream.currentToken.tokenType != MPWhitespaceToken && checkMoreTokens) { - id currentValue; - switch (tokenStream.currentToken.tokenType) { - case MPNumberToken: - { - currentValue = [[MPNumber alloc] initWithTokenStream:tokenStream]; - } - break; - - case MPVariableToken: - { - currentValue = [[MPVariable alloc] initWithTokenStream:tokenStream]; - } - break; - - case MPGenericFunctionToken: - { - currentValue = (id)tokenStream.currentToken; - if ([currentValue isKindOfClass:[MPSuffixFunction class]]) { - ((MPSuffixFunction *)currentValue).baseValue = nil; - } - [tokenStream currentTokenConsumed]; - } - break; - - case MPSinToken: - case MPCosToken: - case MPTanToken: - case MPASinToken: - case MPACosToken: - case MPATanToken: - { - currentValue = [[MPFunctionValue alloc] initWithTokenStream:tokenStream]; - } - break; - - case MPUnidentifiedToken: - case MPEqualsToken: - currentValue = [[MPUnexpectedSymbolValue alloc] initWithTokenStream:tokenStream]; - break; - - default: - checkMoreTokens = NO; - break; - } - if (checkMoreTokens) { - [_values addObject:[tokenStream consumeSuffixesForValue:currentValue]]; - } - } - - [tokenStream endIgnoringOrAcceptingWhitespaceTokens]; - } - return self; -} - -- (BOOL)validate:(NSError *__autoreleasing *)error -{ - if (_values.count == 0) { - if (error) { - *error = MPParseError(8, - NSLocalizedString(@"Expected Value.", @"Error message. This is displayed when a value was expected but none was found."), - nil); - } - return NO; - } - for (id value in _values) { - if (![value validate:error]) { - return NO; - } - } - return YES; -} - -- (NSDecimalNumber *)evaluate -{ - NSDecimalNumber *result = [NSDecimalNumber one]; - for (id value in _values) { - NSDecimalNumber *currentValue = [value evaluate]; - if ([currentValue isEqualToNumber:[NSDecimalNumber notANumber]]) { - result = currentValue; - break; - } - result = [result decimalNumberByMultiplyingBy:currentValue]; - if ([result compare:@(0)] == NSOrderedSame) { - break; - } - } - return result; -} - -@end - - -@implementation MPTokenStream (MPValueSuffixes) - -- (id)consumeSuffixesForValue:(id)value -{ - BOOL repeat = YES; - while (repeat) { - if (self.currentToken.tokenType == MPFactorialToken) { - MPFactorial *factorial = [[MPFactorial alloc] init]; - factorial.value = value; - value = factorial; - [self currentTokenConsumed]; - } else if (self.currentToken.tokenType == MPGenericFunctionToken && [self.currentToken isKindOfClass:[MPSuffixFunction class]]) { - MPSuffixFunction *token = (MPSuffixFunction *)self.currentToken; - token.baseValue = value; - value = token; - [self currentTokenConsumed]; - } else { - repeat = NO; - } - } - return value; -} - -@end \ No newline at end of file