Added/Corrected Documentation
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
|
||||
#import "MPToken.h"
|
||||
#import "MPFunction+MPToken.h"
|
||||
#import "MPTokenStream.h"
|
||||
|
||||
|
||||
#import "MPEvaluationContext.h"
|
||||
|
||||
@@ -63,9 +63,7 @@
|
||||
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 */; };
|
||||
3BBEA92C19BB680B00133766 /* MathKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B85830D19BB5E5500D76A8D /* MathKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
3BBEA93519BB79A700133766 /* MPExpression.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BFAC38E1997B61300B3EF67 /* MPExpression.m */; };
|
||||
3BBEA93619BB79A700133766 /* MPFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B87E35F19009D5F00259938 /* MPFunction.m */; };
|
||||
3BBEA93A19BB79A700133766 /* MPSumFunction.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BB09EC81906FD830080A5ED /* MPSumFunction.m */; };
|
||||
@@ -223,8 +221,6 @@
|
||||
3BB09EDD190728220080A5ED /* NSIndexPath+MPAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSIndexPath+MPAdditions.m"; sourceTree = "<group>"; };
|
||||
3BB09EDF190736160080A5ED /* MPSumFunctionLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSumFunctionLayout.h; sourceTree = "<group>"; };
|
||||
3BB09EE0190736160080A5ED /* MPSumFunctionLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPSumFunctionLayout.m; sourceTree = "<group>"; };
|
||||
3BB18AA319CDB3A900986DA0 /* MPTokenStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPTokenStream.h; sourceTree = "<group>"; };
|
||||
3BB18AA419CDB3A900986DA0 /* MPTokenStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPTokenStream.m; sourceTree = "<group>"; };
|
||||
3BBBA3941905704200824E74 /* MPRangeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MPRangeTests.m; path = ../MathPadTests/MPRangeTests.m; sourceTree = "<group>"; };
|
||||
3BC4661319B245C60033F13A /* Fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Fonts; sourceTree = "<group>"; };
|
||||
3BC4661519B365070033F13A /* MPArrayCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPArrayCache.h; sourceTree = "<group>"; };
|
||||
@@ -483,8 +479,6 @@
|
||||
3B7B3A2B19CC467E005849E5 /* MPToken.m */,
|
||||
3B7B3A5219CC50B1005849E5 /* MPFunction+MPToken.h */,
|
||||
3B7B3A5319CC50B1005849E5 /* MPFunction+MPToken.m */,
|
||||
3BB18AA319CDB3A900986DA0 /* MPTokenStream.h */,
|
||||
3BB18AA419CDB3A900986DA0 /* MPTokenStream.m */,
|
||||
3BB09EBC1905EF210080A5ED /* Functions */,
|
||||
3BC46B4F19B506F20033F13A /* Evaluation */,
|
||||
);
|
||||
@@ -671,7 +665,6 @@
|
||||
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 */,
|
||||
3B7B3A1819CC44E4005849E5 /* MPExpressionTokenizer.h in Headers */,
|
||||
@@ -774,7 +767,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
CLASSPREFIX = MP;
|
||||
LastUpgradeCheck = 0510;
|
||||
LastUpgradeCheck = 0610;
|
||||
ORGANIZATIONNAME = "Kim Wittenburg";
|
||||
TargetAttributes = {
|
||||
3B85831C19BB5E5500D76A8D = {
|
||||
@@ -890,7 +883,6 @@
|
||||
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 */,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0510"
|
||||
LastUpgradeVersion = "0610"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -39,6 +39,15 @@
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3B85830C19BB5E5500D76A8D"
|
||||
BuildableName = "MathKit.framework"
|
||||
BlueprintName = "MathKit"
|
||||
ReferencedContainer = "container:MathPad.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0510"
|
||||
LastUpgradeVersion = "0610"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -53,14 +53,5 @@
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-32" y="380.5"/>
|
||||
</window>
|
||||
<collectionViewItem id="J9S-PW-LCL">
|
||||
<connections>
|
||||
<outlet property="view" destination="7zX-37-dQb" id="TRV-ee-wcp"/>
|
||||
</connections>
|
||||
</collectionViewItem>
|
||||
<view id="7zX-37-dQb">
|
||||
<rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
||||
|
||||
@@ -338,287 +338,6 @@
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Format" id="jxT-CU-nIS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
|
||||
<items>
|
||||
<menuItem title="Font" id="Gi5-1S-RQB">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
|
||||
<items>
|
||||
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
|
||||
<connections>
|
||||
<action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
|
||||
<connections>
|
||||
<action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
|
||||
<connections>
|
||||
<action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
|
||||
<connections>
|
||||
<action selector="underline:" target="-1" id="FYS-2b-JAY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
|
||||
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
|
||||
<connections>
|
||||
<action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
|
||||
<connections>
|
||||
<action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
|
||||
<menuItem title="Kern" id="jBQ-r6-VK2">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="GUa-eO-cwY">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use None" id="cDB-IK-hbR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Tighten" id="46P-cB-AYj">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Loosen" id="ogc-rX-tC1">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Ligatures" id="o6e-r0-MWq">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="agt-UL-0e3">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use None" id="J7y-lM-qPV">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use All" id="xQD-1f-W4t">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Baseline" id="OaQ-X3-Vso">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
|
||||
<items>
|
||||
<menuItem title="Use Default" id="3Om-Ey-2VK">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Superscript" id="Rqc-34-cIF">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Subscript" id="I0S-gh-46l">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Raise" id="2h7-ER-AoG">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Lower" id="1tx-W0-xDw">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
|
||||
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
|
||||
<connections>
|
||||
<action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
|
||||
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Text" id="Fal-I4-PZk">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Text" id="d9c-me-L2H">
|
||||
<items>
|
||||
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
|
||||
<connections>
|
||||
<action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
|
||||
<connections>
|
||||
<action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Justify" id="J5U-5w-g23">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
|
||||
<connections>
|
||||
<action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
|
||||
<menuItem title="Writing Direction" id="H1b-Si-o9J">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
|
||||
<items>
|
||||
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem id="YGs-j5-SAR">
|
||||
<string key="title"> Default</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="Lbh-J2-qVU">
|
||||
<string key="title"> Left to Right</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="jFq-tB-4Kx">
|
||||
<string key="title"> Right to Left</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
|
||||
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem id="Nop-cj-93Q">
|
||||
<string key="title"> Default</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="BgM-ve-c93">
|
||||
<string key="title"> Left to Right</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem id="RB4-Sm-HuC">
|
||||
<string key="title"> Right to Left</string>
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
|
||||
<menuItem title="Show Ruler" id="vLm-3I-IUL">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="View" id="H8h-7b-M4v">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="View" id="HyV-fh-RgO">
|
||||
<items>
|
||||
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Window" id="aUF-d1-5bR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
|
||||
|
||||
@@ -8,7 +8,10 @@
|
||||
|
||||
#import "MPTerm.h"
|
||||
|
||||
@class MPElementaryFunctionTerm, MPValueGroup;
|
||||
|
||||
|
||||
@class MPElementaryFunctionTerm;
|
||||
|
||||
|
||||
@interface MPElementaryFunctionTerm : MPTerm
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#import "MPParsedExpression.h"
|
||||
#import "MPPowerFunction.h"
|
||||
#import "MPProductTerm.h"
|
||||
#import "MPTokenStream.h"
|
||||
#import "MPToken.h"
|
||||
|
||||
#import "MPExpression.h"
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
|
||||
@class MPEvaluationContext;
|
||||
|
||||
|
||||
@interface MPEvaluationContext : NSObject
|
||||
|
||||
+ (MPEvaluationContext *)sharedContext;
|
||||
|
||||
@@ -33,12 +33,22 @@ FOUNDATION_EXPORT NSString *const MPIllegalElementExceptionElementKey;
|
||||
|
||||
/*!
|
||||
@typedef MPReferenceFrame
|
||||
@brief A reference frame describes what an @em item is.
|
||||
@brief A reference frame describes what an @em item in an expression is.
|
||||
|
||||
@discussion An item may be an element, a symbol or a token. A symbol is the
|
||||
smallest possible size for an item. An element as well as a token
|
||||
consist of one or more symbols. Similarly an element consists of
|
||||
one or more tokens.
|
||||
@discussion Reference frames have to be passed in multiple methods of the @c
|
||||
MPExpression class. You can convert between reference frames
|
||||
using the following methods:
|
||||
<pre>
|
||||
@textblock
|
||||
- convertIndexFromReferenceFrame:toReferenceFrame:
|
||||
- convertIndexFromReferenceFrame:toReferenceFrame:offset:
|
||||
@/textblock
|
||||
</pre>
|
||||
|
||||
There are three different types of items (reference frames):
|
||||
symbols, tokens and elements. A symbol is the smalles possible
|
||||
unit in an expression. Thus a token consists of one or more
|
||||
symbols. Similarly an element consists of one or more tokens.
|
||||
|
||||
@constant MPElementReferenceFrame
|
||||
Specifies that items should be interpreted as elements. An
|
||||
@@ -46,8 +56,8 @@ FOUNDATION_EXPORT NSString *const MPIllegalElementExceptionElementKey;
|
||||
|
||||
@constant MPSymbolReferenceFrame
|
||||
Specifies that items should be interpreted as symbols. A symbol
|
||||
can be a single character (as they are for example typed in by
|
||||
the user) or a @c MPFunction object.
|
||||
can be a single character (represented by the @c NSString class)
|
||||
or a @c MPFunction object.
|
||||
|
||||
@constant MPTokenReferenceFrame
|
||||
Specifies that items should be interpreted as tokens. A token is
|
||||
@@ -55,7 +65,7 @@ FOUNDATION_EXPORT NSString *const MPIllegalElementExceptionElementKey;
|
||||
character (e.g. '+'), an arbitrary number of characters (e.g. a
|
||||
number) or a @c MPFunction object.
|
||||
|
||||
All tokens must conform to the @c MPToken protocol.
|
||||
All tokens conform to the @c MPToken protocol.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, MPReferenceFrame) {
|
||||
MPElementReferenceFrame,
|
||||
@@ -68,6 +78,7 @@ typedef NS_ENUM(NSUInteger, MPReferenceFrame) {
|
||||
@class MPExpression, MPFunction, MPRangePath, MPParsedExpression;
|
||||
@protocol MPExpressionElement, MPToken;
|
||||
|
||||
|
||||
/*!
|
||||
@class MPExpression
|
||||
@brief An @c MPExpression object is the base object for any mathematical
|
||||
@@ -76,15 +87,11 @@ typedef NS_ENUM(NSUInteger, MPReferenceFrame) {
|
||||
@discussion Every expression consists of string elements (represented by the
|
||||
@c NSString class) and function elements (represented by the @c
|
||||
MPFunction class). Functions likewise can have expressions as
|
||||
elements (also called @em children in this context). Both
|
||||
elements (also called <i>children</i> in this context). Both
|
||||
expressions and functions are mutable. Through this organization
|
||||
expression are organized in a tree-like structure called the
|
||||
'expression tree'.
|
||||
|
||||
@note There is also the @c MPExpressionTree class. That class provides
|
||||
an alternative representation of an expression. The 'expression
|
||||
tree' does not refer to that class.
|
||||
|
||||
An expression can evaluate itself giving you either a
|
||||
result or possibly an error if the expression was not constructed
|
||||
correctly or could not be evaluated.
|
||||
@@ -128,7 +135,8 @@ typedef NS_ENUM(NSUInteger, MPReferenceFrame) {
|
||||
|
||||
/*!
|
||||
@method initWithElements:
|
||||
@brief Initializes a newly created expression with the given elements.
|
||||
@brief Initializes a newly created expression with the specified
|
||||
elements.
|
||||
|
||||
@discussion All elements must conform to the @c MPExpressionElement protocol.
|
||||
If one or more objects do not conform to that protocol an @c
|
||||
@@ -206,8 +214,8 @@ typedef NS_ENUM(NSUInteger, MPReferenceFrame) {
|
||||
@param referenceFrame
|
||||
The reference frame that should be used to count the items.
|
||||
|
||||
@return The current number of items in the receiver counted in the given
|
||||
reference frame.
|
||||
@return The current number of items in the receiver counted in the
|
||||
specified reference frame.
|
||||
*/
|
||||
- (NSUInteger)countItemsInReferenceFrame:(MPReferenceFrame)referenceFrame;
|
||||
|
||||
@@ -472,8 +480,8 @@ typedef NS_ENUM(NSUInteger, MPReferenceFrame) {
|
||||
|
||||
/*!
|
||||
@method replaceItemsInRange:referenceFrame:withElements:
|
||||
@brief Replaces the elements in the given range with the contents of the
|
||||
@c elements array.
|
||||
@brief Replaces the elements in the specified range with the contents of
|
||||
the @c elements array.
|
||||
|
||||
@discussion This is the most primitive mutation method of @c MPExpression.
|
||||
Every other mutating method utlimately must call this method.
|
||||
@@ -515,8 +523,8 @@ typedef NS_ENUM(NSUInteger, MPReferenceFrame) {
|
||||
@param referenceFrame
|
||||
The reference frame @c from is specified in.
|
||||
|
||||
@return An expression containing the items from the given index to the
|
||||
end.
|
||||
@return An expression containing the items from the specified index to
|
||||
the end of the receiver.
|
||||
*/
|
||||
- (MPExpression *)subexpressionFromIndex:(NSUInteger)from
|
||||
referenceFrame:(MPReferenceFrame)referenceFrame;
|
||||
@@ -537,8 +545,8 @@ typedef NS_ENUM(NSUInteger, MPReferenceFrame) {
|
||||
@param referenceFrame
|
||||
The reference frame @c to is specified in.
|
||||
|
||||
@return An expression containing the items from the first item to the
|
||||
given index.
|
||||
@return An expression containing the items from the first item to the one
|
||||
at the specified index.
|
||||
*/
|
||||
- (MPExpression *)subexpressionToIndex:(NSUInteger)to
|
||||
referenceFrame:(MPReferenceFrame)referenceFrame;
|
||||
@@ -572,7 +580,7 @@ typedef NS_ENUM(NSUInteger, MPReferenceFrame) {
|
||||
|
||||
|
||||
/*!
|
||||
@method evaluateWitError:
|
||||
@method evaluateWitErrors:
|
||||
@brief Evaluates the receiver.
|
||||
|
||||
@discussion This is a convenience method for evaluating an expression. If you
|
||||
@@ -580,34 +588,66 @@ typedef NS_ENUM(NSUInteger, MPReferenceFrame) {
|
||||
instead.
|
||||
|
||||
@param errors
|
||||
If the receiver (or any of its elements) contains a syntax error
|
||||
or can not be evaluated this parameter is set to an appropriate
|
||||
value. Pass @c NULL if you are not interested in any errors that
|
||||
might occur.
|
||||
If the receiver (or any of its elements) contain syntax errors or
|
||||
can not be evaluated this parameter is set to an appropriate
|
||||
value. All items in the array are @c NSError instances. This
|
||||
parameter is never set to an empty array.
|
||||
Pass @c NULL if you are not interested in any errors that might
|
||||
occur.
|
||||
|
||||
@return The result of the evaluation or @c nil of the receiver could not
|
||||
be evaluated. In that case the @c error parameter is set to an
|
||||
appropriate value. If @c NaN is returned it means there was a
|
||||
math error. In most cases the error parameter contains an
|
||||
appropriate description of the problem.
|
||||
appropriate value.
|
||||
*/
|
||||
- (NSDecimalNumber *)evaluateWithErrors:(NSArray *__autoreleasing *)errors;
|
||||
|
||||
|
||||
/*!
|
||||
@method parse
|
||||
@method parse:
|
||||
@brief Parses the receiver.
|
||||
|
||||
@discussion This method returns a valid object even if the expression
|
||||
contains syntax errors. Send the returned object a @c -validate:
|
||||
message to check for syntax errors before you evaluate it. For
|
||||
more information on evaluation see the documentation of @c
|
||||
MPExpressionTree.
|
||||
@discussion This is a convenience method that calls @c
|
||||
-parseExpectingVariable:errors: with @c NO as the first argument.
|
||||
|
||||
@return A @c MPExpressionTree object that can evaluate the receiver.
|
||||
@param errors
|
||||
If the receiver (or any of its elements) contain syntax errors
|
||||
this parameter is set to an appropriate value. All items in the
|
||||
array are @c NSError instances. This parameter is never set to an
|
||||
empty array.
|
||||
Pass @c NULL if you are not interested in any errors that might
|
||||
occur.
|
||||
|
||||
@return A @c MPParsedExpression object that represents the receiver and
|
||||
can be evaluated or @c nil if an error occurs. In that case the
|
||||
@c errors parameter is set to an array containing at least one
|
||||
@c NSError instance.
|
||||
*/
|
||||
- (MPParsedExpression *)parse:(NSArray *__autoreleasing *)errors;
|
||||
|
||||
|
||||
/*!
|
||||
@method parseExpectingVariable:errors:
|
||||
@brief Parses the receiver.
|
||||
|
||||
@param flag
|
||||
If @c YES the receiver must (exept for whitespaces) begin with a
|
||||
single letter followed by an equals sign. If it doesn't the
|
||||
expression is considered invalid. Specify @c NO If the expression
|
||||
should be evaluatable by itself.
|
||||
|
||||
@param errors
|
||||
If the receiver (or any of its elements) contain syntax errors
|
||||
this parameter is set to an appropriate value. All items in the
|
||||
array are @c NSError instances. This parameter is never set to an
|
||||
empty array.
|
||||
Pass @c NULL if you are not interested in any errors that might
|
||||
occur.
|
||||
|
||||
@return A @c MPParsedExpression object that represents the receiver and
|
||||
can be evaluated or @c nil if an error occurs. In that case the
|
||||
@c errors parameter is set to an array containing at least one
|
||||
@c NSError instance.
|
||||
*/
|
||||
- (MPParsedExpression *)parseExpectingVariable:(BOOL)flag
|
||||
errors:(NSArray *__autoreleasing *)errors;
|
||||
|
||||
@@ -645,6 +685,14 @@ typedef NS_ENUM(NSUInteger, MPReferenceFrame) {
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
@category MPExpression (MPExpressionConvenience)
|
||||
@brief This category defines convenience methods for the @c MPExpression
|
||||
class.
|
||||
|
||||
@discussion All convenience methods are completely defined in terms of other
|
||||
methods of the @c MPExpression class.
|
||||
*/
|
||||
@interface MPExpression (MPExpressionConvenience)
|
||||
|
||||
#pragma mark Querying Expressions
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#import "MPLayout.h"
|
||||
|
||||
|
||||
|
||||
@class MPExpressionLayout, MPExpression, MPFunctionLayout;
|
||||
|
||||
@interface MPExpressionLayout : MPLayout
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPExpression.h"
|
||||
#import "MPParsedExpression.h"
|
||||
|
||||
|
||||
@class MPExpressionParser, MPExpression, MPParsedExpression;
|
||||
|
||||
|
||||
@interface MPExpressionParser : NSObject
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#import "MPExpressionParser.h"
|
||||
|
||||
#import "MPExpression.h"
|
||||
#import "MPTokenStream.h"
|
||||
#import "MPTerm.h"
|
||||
#import "MPToken.h"
|
||||
#import "MPSumTerm.h"
|
||||
@@ -18,6 +17,7 @@
|
||||
#import "MPElementaryFunctionTerm.h"
|
||||
#import "MPFunctionTerm.h"
|
||||
#import "MPPowerTerm.h"
|
||||
#import "MPParsedExpression.h"
|
||||
#import "MPNegatedTerm.h"
|
||||
|
||||
#import "MPNumber.h"
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#import "MPExpression.h"
|
||||
|
||||
|
||||
|
||||
@class MPExpressionStorage, MPExpressionView, MPExpressionLayout;
|
||||
|
||||
|
||||
@interface MPExpressionStorage : MPExpression
|
||||
|
||||
- (instancetype)initWithElements:(NSArray *)elements;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// MPExpressionLexer.h
|
||||
// MPExpressionTokenizer.h
|
||||
// MathPad
|
||||
//
|
||||
// Created by Kim Wittenburg on 19.09.14.
|
||||
@@ -32,6 +32,6 @@
|
||||
|
||||
@return An array of objects that conform to the @c MPToken protocol.
|
||||
*/
|
||||
+ (NSArray *)tokenizeExpression:(MPExpression *)expression; // Returns MPToken's
|
||||
+ (NSArray *)tokenizeExpression:(MPExpression *)expression;
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// MPExpressionLexer.m
|
||||
// MPExpressionTokenizer.m
|
||||
// MathPad
|
||||
//
|
||||
// Created by Kim Wittenburg on 19.09.14.
|
||||
@@ -40,7 +40,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
+ (NSArray *)tokenizeElement:(NSString *)element
|
||||
elementSymbolIndex:(NSUInteger)symbolIndex
|
||||
{
|
||||
|
||||
@@ -8,7 +8,10 @@
|
||||
|
||||
// TODO: Undo/Redo + Delegate (evaluateExpressionView:evaluate...)
|
||||
|
||||
@class MPExpressionView, MPExpressionStorage, MPExpressionLayout, MPRangePath;
|
||||
|
||||
|
||||
@class MPExpressionView, MPExpressionStorage, MPRangePath;
|
||||
|
||||
|
||||
@interface MPExpressionView : NSView
|
||||
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
|
||||
#import "MPTerm.h"
|
||||
|
||||
|
||||
|
||||
@class MPFactorialTerm;
|
||||
|
||||
|
||||
@interface MPFactorialTerm : MPTerm
|
||||
|
||||
- (instancetype)initWithTerm:(MPTerm *)term; /* designated initializer */
|
||||
|
||||
@@ -8,11 +8,35 @@
|
||||
|
||||
#import "MPFunction.h"
|
||||
|
||||
|
||||
|
||||
@class MPFractionFunction, MPExpression;
|
||||
|
||||
|
||||
/*!
|
||||
@class MPFractionFunction
|
||||
@brief This class represents a fraction.
|
||||
|
||||
@discussion When a fraction is evaluated the nominator is divided by the
|
||||
denominator.
|
||||
*/
|
||||
@interface MPFractionFunction : MPFunction
|
||||
|
||||
/*!
|
||||
@property nominatorExpression
|
||||
@brief The receiver's nominator.
|
||||
|
||||
@discussion The nominator must not define a variable.
|
||||
*/
|
||||
@property (nonatomic, strong) MPExpression *nominatorExpression;
|
||||
|
||||
|
||||
/*!
|
||||
@property denominatorExpression
|
||||
@brief The receiver's denominator.
|
||||
|
||||
@discussion The denominator must not define a variable.
|
||||
*/
|
||||
@property (nonatomic, strong) MPExpression *denominatorExpression;
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#import "MPFunctionLayout.h"
|
||||
|
||||
|
||||
|
||||
@class MPFractionFunctionLayout, MPFractionFunction;
|
||||
|
||||
|
||||
@interface MPFractionFunctionLayout : MPFunctionLayout
|
||||
|
||||
- (MPFractionFunction *)fractionFunction;
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
|
||||
#import "MPFunctionTerm.h"
|
||||
|
||||
|
||||
|
||||
@class MPFractionTerm;
|
||||
|
||||
|
||||
@interface MPFractionTerm : MPFunctionTerm
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#import "MPFractionTerm.h"
|
||||
|
||||
#import "MPParsedExpression.h"
|
||||
|
||||
@implementation MPFractionTerm
|
||||
|
||||
- (NSDecimalNumber *)doEvaluation:(NSError *__autoreleasing *)error
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#import "MPExpression.h"
|
||||
#import "MPPowerFunction.h"
|
||||
|
||||
|
||||
|
||||
@implementation MPFunction (MPToken)
|
||||
|
||||
- (MPTokenType)tokenType
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
|
||||
|
||||
@class MPFunction, MPExpression, MPRangePath, MPFunctionTerm;
|
||||
@class MPFunction, MPExpression, MPRangePath;
|
||||
@protocol MPExpressionElement;
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
|
||||
/*!
|
||||
@method childAtIndex:
|
||||
@brief Returns the child at the given index.
|
||||
@brief Returns the child at the specified index.
|
||||
|
||||
@discussion The ordering of children is determined by the order of the
|
||||
children returned from the @c -childrenAccessors method.
|
||||
@@ -243,9 +243,29 @@
|
||||
|
||||
|
||||
#pragma mark Evaluating Functions
|
||||
/*!
|
||||
@methodgroup Evaluating Functions
|
||||
*/
|
||||
|
||||
|
||||
- (BOOL)expectsVariableDefinitionInChildAtIndex:(NSUInteger)index;
|
||||
/*!
|
||||
@method expectsVariableDefinitionInChildAtIndex:
|
||||
@brief Returns whether the child at @c anIndex is supposed to contain a
|
||||
variable definition.
|
||||
|
||||
@discussion This method is automatically called during expression parsing.
|
||||
You can override this method to opt into the default behaviour.
|
||||
If you override this method you do not need to call super.
|
||||
|
||||
The default implementation just returns @c NO for every index.
|
||||
|
||||
@param anIndex
|
||||
The index of the child to check.
|
||||
|
||||
@return @c YES if the child at @c anIndex is supposed to contain a
|
||||
variable definition, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)expectsVariableDefinitionInChildAtIndex:(NSUInteger)anIndex;
|
||||
|
||||
@end
|
||||
|
||||
@@ -263,7 +283,9 @@
|
||||
@interface MPFunction (MPSubclassOverride)
|
||||
|
||||
/* In Addition to the methods listed below MPFunction subclasses should also
|
||||
* override the NSObject methods -description and -hash.
|
||||
* override the NSObject method -description.
|
||||
* Also -expectsVariabledefinitionInChildAtIndex: can be overridden if one of the
|
||||
* children should contain a variable definition.
|
||||
*/
|
||||
|
||||
#pragma mark Working With the Expression Tree
|
||||
@@ -291,6 +313,18 @@
|
||||
@methodgroup Evaluating Functions
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
@method functionTermClass
|
||||
@brief Returns the class that represents the receiver's evaluation
|
||||
behaviour.
|
||||
|
||||
@discussion The class returned must be a subclass of @c MPFunctionTerm. That
|
||||
class must not implement a custom initializer.
|
||||
|
||||
@return The @c MPFunctionTerm subclass that can evaluate instances of the
|
||||
receiver's class.
|
||||
*/
|
||||
- (Class)functionTermClass;
|
||||
|
||||
@end
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
@implementation MPFunction
|
||||
|
||||
|
||||
#pragma mark Creation Methods
|
||||
|
||||
|
||||
@@ -151,13 +152,6 @@
|
||||
}
|
||||
|
||||
|
||||
- (NSUInteger)hash
|
||||
{
|
||||
#warning Unimplemented Method
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - NSCopying
|
||||
|
||||
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#import "MPLayout.h"
|
||||
|
||||
|
||||
|
||||
@class MPFunctionLayout, MPFunction, MPExpressionLayout;
|
||||
|
||||
|
||||
@interface MPFunctionLayout : MPLayout
|
||||
|
||||
+ (MPFunctionLayout *)functionLayoutForFunction:(MPFunction *)function
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
#import "MPTerm.h"
|
||||
|
||||
#import "MPParsedExpression.h"
|
||||
#import "MPFunction.h"
|
||||
|
||||
|
||||
@class MPFunctionTerm, MPFunction, MPParsedExpression;
|
||||
|
||||
|
||||
@interface MPFunctionTerm : MPTerm
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
#import "MPFunctionTerm.h"
|
||||
|
||||
#import "MPFunction.h"
|
||||
#import "MPExpression.h"
|
||||
#import "MPParsedExpression.h"
|
||||
|
||||
#import "MPToken.h"
|
||||
#import "MPTokenStream.h"
|
||||
#import "MPExpression.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
|
||||
@class MPFunctionsViewController, MPFunctionsCollectionView;
|
||||
|
||||
|
||||
@interface MPFunctionsViewController : NSViewController
|
||||
|
||||
- (id)init;
|
||||
|
||||
@@ -14,8 +14,11 @@
|
||||
#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
|
||||
|
||||
#pragma mark Creation Methods
|
||||
|
||||
@@ -6,12 +6,16 @@
|
||||
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
|
||||
FOUNDATION_EXPORT NSString *MPMathRulesMaximumOperatorChainLengthKey;
|
||||
FOUNDATION_EXPORT NSString *MPMathRulesMaximumOperatorChainLengthInMultiplicationKey;
|
||||
FOUNDATION_EXPORT NSString *MPMathRulesIsUsingDegreesKey;
|
||||
|
||||
|
||||
@class MPMathRules;
|
||||
|
||||
|
||||
@interface MPMathRules : NSObject
|
||||
|
||||
+ (MPMathRules *)sharedRules;
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
|
||||
#import "MPTerm.h"
|
||||
|
||||
|
||||
|
||||
@class MPNegatedTerm;
|
||||
|
||||
|
||||
@interface MPNegatedTerm : MPTerm
|
||||
|
||||
- (instancetype)initWithTerm:(MPTerm *)term; /* designated initializer */
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#import "MPTerm.h"
|
||||
|
||||
|
||||
|
||||
@class MPNumber;
|
||||
|
||||
|
||||
@interface MPNumber : MPTerm
|
||||
|
||||
- (instancetype)initWithNumber:(NSDecimalNumber *)number; /* designated initializer */
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#import "MPParsedExpression.h"
|
||||
|
||||
#import "MPTokenStream.h"
|
||||
#import "MPToken.h"
|
||||
|
||||
@implementation MPNumber
|
||||
|
||||
@@ -8,10 +8,28 @@
|
||||
|
||||
#import "MPFunction.h"
|
||||
|
||||
|
||||
|
||||
@class MPParenthesisFunction, MPExpression;
|
||||
|
||||
|
||||
/*!
|
||||
@class MPParenthesisFunction
|
||||
@brief A parenthesis function encapsulates a single expression and thus
|
||||
prioritizes it in evaluation.
|
||||
|
||||
@discussion Prioritizing the expression means that the complete expression
|
||||
must be evaluated 'as is'. No part of it can be 'used' elsewhere
|
||||
before the parenthesis function has been evaluated.
|
||||
*/
|
||||
@interface MPParenthesisFunction : MPFunction
|
||||
|
||||
/*!
|
||||
@property expression
|
||||
@brief The expression encapsulated by the parenthesis.
|
||||
|
||||
@discussion The expression must not define a variable.
|
||||
*/
|
||||
@property (nonatomic, strong) MPExpression *expression;
|
||||
|
||||
@end
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#import "MPExpression.h"
|
||||
#import "MPParenthesisTerm.h"
|
||||
|
||||
|
||||
|
||||
@implementation MPParenthesisFunction
|
||||
|
||||
MPFunctionAccessorImplementation(Expression, _expression)
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#import "MPFunctionLayout.h"
|
||||
|
||||
|
||||
|
||||
@class MPParenthesisFunctionLayout, MPParenthesisFunction;
|
||||
|
||||
|
||||
@interface MPParenthesisFunctionLayout : MPFunctionLayout
|
||||
|
||||
- (MPParenthesisFunction *)parenthesisFunction;
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
|
||||
#import "MPFunctionTerm.h"
|
||||
|
||||
|
||||
|
||||
@class MPParenthesisTerm;
|
||||
|
||||
|
||||
@interface MPParenthesisTerm : MPFunctionTerm
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#import "MPParenthesisTerm.h"
|
||||
|
||||
#import "MPParsedExpression.h"
|
||||
|
||||
@implementation MPParenthesisTerm
|
||||
|
||||
- (NSDecimalNumber *)doEvaluation:(NSError *__autoreleasing *)error
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
||||
//
|
||||
|
||||
@class MPParsedExpression, MPTokenStream, MPTerm;
|
||||
@protocol MPToken;
|
||||
|
||||
|
||||
@class MPParsedExpression, MPTerm;
|
||||
|
||||
|
||||
/*!
|
||||
@const MPMathKitErrorDomain
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#import "MPParsedExpression.h"
|
||||
|
||||
#import "MPTokenStream.h"
|
||||
#import "MPToken.h"
|
||||
|
||||
#import "MPTerm.h"
|
||||
|
||||
@@ -8,16 +8,24 @@
|
||||
|
||||
#import "MPFunction.h"
|
||||
|
||||
|
||||
|
||||
@class MPPowerFunction, MPExpression;
|
||||
|
||||
|
||||
/*!
|
||||
@class MPPowerFunction
|
||||
@brief This class represents a power.
|
||||
*/
|
||||
@interface MPPowerFunction : MPFunction
|
||||
|
||||
/*!
|
||||
@property baseValue
|
||||
@brief The receiver's base value.
|
||||
@property exponentExpression
|
||||
@brief The receiver's exponent.
|
||||
|
||||
@discussion The base value is the thing a suffix function applies to (e.g.
|
||||
a power's base).
|
||||
@discussion The base of the power can only be set during evaluation because
|
||||
it is not actually part of the function element.
|
||||
The exponent must not define a variable.
|
||||
*/
|
||||
@property (nonatomic, strong) MPExpression *exponentExpression;
|
||||
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#import "MPFunctionLayout.h"
|
||||
|
||||
|
||||
|
||||
@class MPPowerFunctionLayout, MPPowerFunction;
|
||||
|
||||
|
||||
@interface MPPowerFunctionLayout : MPFunctionLayout
|
||||
|
||||
@property (nonatomic) NSRect baseBounds;
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
|
||||
#import "MPFunctionTerm.h"
|
||||
|
||||
|
||||
|
||||
@class MPPowerTerm, MPTerm;
|
||||
|
||||
|
||||
@interface MPPowerTerm : MPFunctionTerm
|
||||
|
||||
@property (nonatomic, strong) MPTerm *baseTerm;
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
|
||||
#import "MPTerm.h"
|
||||
|
||||
|
||||
|
||||
@class MPProductTerm;
|
||||
|
||||
|
||||
@interface MPProductTerm : MPTerm
|
||||
|
||||
- (instancetype)initWithFactors:(NSArray *)factors; /* designated initializer */
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#import "MPPowerTerm.h"
|
||||
#import "MPVariable.h"
|
||||
|
||||
#import "MPTokenStream.h"
|
||||
#import "MPToken.h"
|
||||
|
||||
@implementation MPProductTerm
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#import "MPExpression.h"
|
||||
|
||||
|
||||
|
||||
/// Convenience Constructor Macro
|
||||
#define MPMakeRangePath(loc, len) [MPRangePath rangePathWithLocation:(loc) length:(len)]
|
||||
|
||||
@@ -50,7 +52,7 @@
|
||||
|
||||
/*!
|
||||
@method initWithRange:
|
||||
@brief Initializes a newly created range path with the given range.
|
||||
@brief Initializes a newly created range path with the specified range.
|
||||
|
||||
@discussion This method is a convenience initializer to convert from a @c
|
||||
NSRange to a @c MPRangePath. The location of @c aRange is
|
||||
@@ -66,7 +68,7 @@
|
||||
|
||||
/*!
|
||||
@method initWithLocation:lenght:
|
||||
@brief Initializes a newly created range path with the given location
|
||||
@brief Initializes a newly created range path with the specified location
|
||||
and length.
|
||||
|
||||
@discussion The last index in the @c location should address the first item
|
||||
@@ -100,7 +102,7 @@
|
||||
/*!
|
||||
@method rangePathWithRange:
|
||||
@brief Allocates a new @c MPRangePath instance and initializes it with
|
||||
the given location and length.
|
||||
the specified location and length.
|
||||
|
||||
@discussion The location of @c aRange is translated into an index path for
|
||||
the range path.
|
||||
@@ -116,7 +118,7 @@
|
||||
/*!
|
||||
@method rangePathWithLocation:length:
|
||||
@brief Allocates a new @c MPRangePath instance and initializes it with
|
||||
the given location and length.
|
||||
the specified location and length.
|
||||
|
||||
@param location
|
||||
The location of the first element that should be addressed by the
|
||||
@@ -254,7 +256,7 @@
|
||||
new exoression. The range path is specified in the length
|
||||
reference frame.
|
||||
|
||||
If the given range exceeds the receiver's bounds a @c
|
||||
If the specified range exceeds the receiver's bounds a @c
|
||||
NSRangeException is raised.
|
||||
|
||||
@param aRangePath
|
||||
|
||||
@@ -6,6 +6,13 @@
|
||||
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
||||
//
|
||||
|
||||
/*!
|
||||
@header
|
||||
This is a description of the MPFunction class.
|
||||
|
||||
It has multiple lines.
|
||||
*/
|
||||
|
||||
#import "MPFunction.h"
|
||||
|
||||
|
||||
@@ -15,8 +22,8 @@
|
||||
|
||||
/*!
|
||||
@class MPSumFunction
|
||||
@brief A sum function (generally noted using a capital sigma) evaluates
|
||||
a term repeatedly and sums up the results.
|
||||
@brief This class represents a sum function (generally noted using a
|
||||
capital sigma).
|
||||
|
||||
@discussion A sum function has a start and a target expression indicating how
|
||||
often the sum expression should be evaluated. Both the value of
|
||||
@@ -37,13 +44,16 @@
|
||||
@discussion The start expression must define a variable that may be used in
|
||||
the sum expression. If the start expression does not define a
|
||||
variable the sum function will fail on validation.
|
||||
@code Some samples
|
||||
*/
|
||||
@property (nonatomic, strong) MPExpression *startExpression; /* Index 0 */
|
||||
|
||||
|
||||
/*!
|
||||
@property startExpression
|
||||
@property targetExpression
|
||||
@brief The value if the last iteration.
|
||||
|
||||
@discussion The target expression must not define a variable.
|
||||
*/
|
||||
@property (nonatomic, strong) MPExpression *targetExpression; /* Index 1 */
|
||||
|
||||
@@ -55,6 +65,8 @@
|
||||
@discussion During evaluation of the sum expression the variable defined in
|
||||
the start expression is available. That variable always contains
|
||||
the value of the current iteration.
|
||||
|
||||
The sum expression itself must not define a variable.
|
||||
*/
|
||||
@property (nonatomic, strong) MPExpression *sumExpression; /* Index 2 */
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#import "MPSumFunctionTerm.h"
|
||||
#import "MPExpression.h"
|
||||
#import "MPEvaluationContext.h"
|
||||
|
||||
|
||||
|
||||
@@ -37,8 +36,6 @@ MPFunctionAccessorImplementation(SumExpression, _sumExpression)
|
||||
return [MPSumFunctionTerm class];
|
||||
}
|
||||
|
||||
#pragma mark Working With Functions
|
||||
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#import "MPFunctionLayout.h"
|
||||
|
||||
|
||||
|
||||
@class MPSumFunctionLayout, MPSumFunction;
|
||||
|
||||
|
||||
@interface MPSumFunctionLayout : MPFunctionLayout
|
||||
|
||||
- (MPSumFunction *)sumFunction;
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
|
||||
#import "MPFunctionTerm.h"
|
||||
|
||||
|
||||
|
||||
@class MPSumFunctionTerm;
|
||||
|
||||
|
||||
@interface MPSumFunctionTerm : MPFunctionTerm
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#import "MPSumFunctionTerm.h"
|
||||
|
||||
#import "MPParsedExpression.h"
|
||||
|
||||
@implementation MPSumFunctionTerm
|
||||
|
||||
- (NSDecimalNumber *)doEvaluation:(NSError *__autoreleasing *)error
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
|
||||
#import "MPTerm.h"
|
||||
|
||||
|
||||
|
||||
@class MPSumTerm;
|
||||
|
||||
|
||||
@interface MPSumTerm : MPTerm
|
||||
|
||||
- (instancetype)initWithSummands:(NSArray *)summands; /* designated initializer */
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#import "MPParsedExpression.h"
|
||||
#import "MPProductTerm.h"
|
||||
|
||||
#import "MPTokenStream.h"
|
||||
#import "MPToken.h"
|
||||
|
||||
@implementation MPSumTerm
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//
|
||||
|
||||
|
||||
@class MPTerm, MPTokenStream;
|
||||
@protocol MPToken;
|
||||
@class MPTerm;
|
||||
|
||||
|
||||
@interface MPTerm : NSObject
|
||||
|
||||
|
||||
@@ -14,9 +14,16 @@
|
||||
|
||||
/*!
|
||||
@typedef MPTokenType
|
||||
@brief A type of a token identifies its behaviour in a mathematical
|
||||
@brief The type of a <code>token</code> identifies its behaviour in a mathematical
|
||||
context.
|
||||
|
||||
@constant MPEOFToken
|
||||
A token that represents the end of the input. This token should
|
||||
not be used to create a @c MPToken instance. It exists so that
|
||||
you can safely send a @c tokenType message to @c nil without
|
||||
getting confusing results. A token with this token type should be
|
||||
interpreted as 'no token'.
|
||||
|
||||
@constant MPMultiplicationSymbolToken
|
||||
A multiplication symbol.
|
||||
|
||||
@@ -82,8 +89,8 @@ typedef NS_ENUM(NSUInteger, MPTokenType) {
|
||||
@brief Returns the receiver's token type.
|
||||
|
||||
@discussion The token type identifies what kind of token the receiver is. For
|
||||
more information see the documentation on the @c MPTokenType
|
||||
enum.
|
||||
more information see the documentation on the <code>MPTokenType
|
||||
</code> enum.
|
||||
|
||||
@return The receiver's token type.
|
||||
*/
|
||||
|
||||
@@ -10,11 +10,17 @@
|
||||
|
||||
|
||||
|
||||
@implementation MPToken {
|
||||
NSRange _range;
|
||||
MPTokenType _tokenType;
|
||||
NSString *_stringValue;
|
||||
}
|
||||
@interface MPToken ()
|
||||
|
||||
@property (readonly, nonatomic) NSRange range;
|
||||
@property (readonly, nonatomic, strong) NSString *stringValue;
|
||||
@property (readonly, nonatomic) MPTokenType tokenType;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation MPToken
|
||||
|
||||
- (instancetype)initWithTokenType:(MPTokenType)tokenType
|
||||
range:(NSRange)range
|
||||
@@ -30,24 +36,6 @@
|
||||
}
|
||||
|
||||
|
||||
- (NSRange)range
|
||||
{
|
||||
return _range;
|
||||
}
|
||||
|
||||
|
||||
- (MPTokenType)tokenType
|
||||
{
|
||||
return _tokenType;
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return _stringValue;
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return self.stringValue;
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
//
|
||||
// MPTokenStream.h
|
||||
// MathPad
|
||||
//
|
||||
// Created by Kim Wittenburg on 20.09.14.
|
||||
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
|
||||
@class MPTokenStream;
|
||||
@protocol MPToken;
|
||||
|
||||
|
||||
/*!
|
||||
@class MPTokenStream
|
||||
@brief This class is a helper class for processing tokens from the
|
||||
beginning of an expression to the end.
|
||||
|
||||
@discussion A token stream is a single-use object. After the stream has
|
||||
reached the end there is no way to reset it.
|
||||
*/
|
||||
@interface MPTokenStream : NSObject
|
||||
|
||||
|
||||
/*!
|
||||
@method initWithTokens:
|
||||
@brief Creates a new token stream that @em streams the contents of the
|
||||
@c tokens array.
|
||||
|
||||
@param tokens
|
||||
The tokens to be @em streamed. All objects in the array must
|
||||
conform to the @c MPToken protocol.
|
||||
|
||||
@return A new token stream.
|
||||
*/
|
||||
- (instancetype)initWithTokens:(NSArray *)tokens; /* designated initializer */
|
||||
|
||||
|
||||
/*!
|
||||
@method beginIgnoringWhitespaceTokens
|
||||
@brief After calling this method a @c -currentToken message will skip
|
||||
whitespace characters before returning the current token.
|
||||
|
||||
@discussion Any call to this method or @c -beginAcceptingWhitespaceTokens
|
||||
must be matched by a @c -endIgnoringOrAcceptingWhitespaceTokens
|
||||
message. Calls to both methods can be nested.
|
||||
|
||||
By default whitespace tokens are accepted.
|
||||
|
||||
@see -beginAcceptingWhitespaceTokens
|
||||
@see -endIgnoringOrAcceptingWhitespaceTokens
|
||||
*/
|
||||
- (void)beginIgnoringWhitespaceTokens;
|
||||
|
||||
|
||||
/*!
|
||||
@method beginAcceptingWhitespaceTokens
|
||||
@brief After calling this method @c -currentToken may return a token of
|
||||
type @c MPWhitespaceToken.
|
||||
|
||||
@discussion Any call to this method or @c -beginAcceptingWhitespaceTokens
|
||||
must be matched by a @c -endIgnoringOrAcceptingWhitespaceTokens
|
||||
message. Calls to both methods can be nested.
|
||||
|
||||
By default whitespace tokens are accepted.
|
||||
|
||||
@see -beginIgnoringWhitespaceTokens
|
||||
@see -endIgnoringOrAcceptingWhitespaceTokens
|
||||
*/
|
||||
- (void)beginAcceptingWhitespaceTokens;
|
||||
|
||||
|
||||
/*!
|
||||
@method endIgnoringOrAcceptingWhitespaceTokens
|
||||
@brief This method balances @c -beginIgnoringWhitespaceTokens and @c
|
||||
-beginAcceptingWhitespaceTokens messages.
|
||||
|
||||
@discussion After this method was
|
||||
calles the whitespace behaviour falls back to the way it behaved
|
||||
before the last @c -beginIgnoringWhitespaceTokens or @c
|
||||
-beginAcceptingWhitespaceTokens message was sent.
|
||||
*/
|
||||
- (void)endIgnoringOrAcceptingWhitespaceTokens;
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
@method hasMoreTokens
|
||||
@brief Use this method to check wether there are any tokens left.
|
||||
|
||||
@discussion This method repects the whitespace skipping behaviour. That means
|
||||
that if the token stream currently ignores whitespaces and there
|
||||
are only whitespaces left in the stream this method returns @c
|
||||
NO.
|
||||
|
||||
@return @c YES if there are more tokens, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)hasMoreTokens;
|
||||
|
||||
|
||||
/*!
|
||||
@method currentToken
|
||||
@brief Returns the receiver's current token.
|
||||
|
||||
@discussion This is one of the core methods of @c MPTokenStream. Subsequent
|
||||
calls to this method will return the same value until @c
|
||||
-currentTokenConsumed is called.
|
||||
|
||||
@return The current token or @c nil if there are no more tokens.
|
||||
*/
|
||||
- (id<MPToken>)currentToken;
|
||||
|
||||
|
||||
/*!
|
||||
@method peekNextToken
|
||||
@brief Looks at the next token and returns it.
|
||||
|
||||
@discussion This method behaves as if you called @c -currentTokenConsumed
|
||||
followed by @c -currentToken except that it does not consume the
|
||||
current token. That means that you can use this method to look at
|
||||
the next token (respecting the current whitespace ignoring
|
||||
behaviour) without changing the @c currentToken.
|
||||
|
||||
@return The next token or @c nil if there is no token after the current
|
||||
one.
|
||||
*/
|
||||
- (id<MPToken>)peekNextToken;
|
||||
|
||||
|
||||
/*!
|
||||
@method currentTokenConsumed
|
||||
@brief Marks the current token as consumed and discards it.
|
||||
*/
|
||||
- (void)currentTokenConsumed;
|
||||
|
||||
@end
|
||||
@@ -1,140 +0,0 @@
|
||||
//
|
||||
// MPTokenStream.m
|
||||
// MathPad
|
||||
//
|
||||
// Created by Kim Wittenburg on 20.09.14.
|
||||
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPTokenStream.h"
|
||||
|
||||
#import "MPToken.h"
|
||||
|
||||
|
||||
|
||||
@interface MPTokenStream ()
|
||||
|
||||
@property (nonatomic, copy) NSArray *tokens;
|
||||
@property (nonatomic) NSUInteger currentTokenIndex;
|
||||
@property (nonatomic) NSUInteger eofLocation;
|
||||
|
||||
@property (nonatomic) BOOL *whitespaceStates;
|
||||
@property (nonatomic) NSUInteger maxWhitespaceIgnores;
|
||||
@property (nonatomic) NSUInteger currentWhitespaceIgnoreState;
|
||||
|
||||
- (void)pushWhitespaceState:(BOOL)state;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation MPTokenStream
|
||||
|
||||
- (instancetype)initWithTokens:(NSArray *)tokens
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.tokens = tokens;
|
||||
self.whitespaceStates = malloc(10 * sizeof(BOOL));
|
||||
self.maxWhitespaceIgnores = 10;
|
||||
self.currentWhitespaceIgnoreState = 0;
|
||||
[self beginAcceptingWhitespaceTokens];
|
||||
_currentTokenIndex = 0;
|
||||
if (tokens.count > 0) {
|
||||
self.eofLocation = NSMaxRange([tokens.lastObject range]);
|
||||
} else {
|
||||
self.eofLocation = 0;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)beginAcceptingWhitespaceTokens
|
||||
{
|
||||
[self pushWhitespaceState:YES];
|
||||
}
|
||||
|
||||
|
||||
- (void)beginIgnoringWhitespaceTokens
|
||||
{
|
||||
[self pushWhitespaceState:NO];
|
||||
}
|
||||
|
||||
|
||||
- (void)pushWhitespaceState:(BOOL)state
|
||||
{
|
||||
self.currentWhitespaceIgnoreState++;
|
||||
if (self.currentWhitespaceIgnoreState >= self.maxWhitespaceIgnores) {
|
||||
self.maxWhitespaceIgnores += 10;
|
||||
BOOL *reallocatedWhitespaceIgnores = realloc(self.whitespaceStates, self.maxWhitespaceIgnores);
|
||||
if (reallocatedWhitespaceIgnores) {
|
||||
self.whitespaceStates = reallocatedWhitespaceIgnores;
|
||||
} else {
|
||||
@throw [NSException exceptionWithName:NSInternalInconsistencyException reason:@"Realloc Failed" userInfo:nil];
|
||||
}
|
||||
}
|
||||
self.whitespaceStates[self.currentWhitespaceIgnoreState] = state;
|
||||
}
|
||||
|
||||
|
||||
- (void)endIgnoringOrAcceptingWhitespaceTokens
|
||||
{
|
||||
self.currentWhitespaceIgnoreState--;
|
||||
}
|
||||
|
||||
|
||||
- (void)skipWhitespaces
|
||||
{
|
||||
if (self.whitespaceStates[self.currentWhitespaceIgnoreState]) {
|
||||
return;
|
||||
}
|
||||
while (_currentTokenIndex < self.tokens.count) {
|
||||
MPToken *token = self.tokens[_currentTokenIndex];
|
||||
if (token.tokenType != MPWhitespaceToken) {
|
||||
return;
|
||||
}
|
||||
_currentTokenIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)hasMoreTokens
|
||||
{
|
||||
[self skipWhitespaces];
|
||||
return _currentTokenIndex < self.tokens.count;
|
||||
}
|
||||
|
||||
|
||||
- (id<MPToken>)currentToken
|
||||
{
|
||||
[self skipWhitespaces];
|
||||
if (_currentTokenIndex >= _tokens.count) {
|
||||
return nil;
|
||||
}
|
||||
return _tokens[_currentTokenIndex];
|
||||
}
|
||||
|
||||
|
||||
- (id<MPToken>)peekNextToken
|
||||
{
|
||||
NSUInteger currentTokenIndex = _currentTokenIndex;
|
||||
[self currentTokenConsumed]; // Pretend the current token has been consumed
|
||||
id<MPToken> token = [self currentToken];
|
||||
_currentTokenIndex = currentTokenIndex; // Undo the lookahead
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
- (void)currentTokenConsumed
|
||||
{
|
||||
[self currentToken];
|
||||
++_currentTokenIndex;
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
free(self.whitespaceStates);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#import "MPTerm.h"
|
||||
|
||||
|
||||
|
||||
@class MPVariable;
|
||||
|
||||
|
||||
@interface MPVariable : MPTerm
|
||||
|
||||
- (instancetype)initWithVariableName:(NSString *)variableName; /* designated initializer */
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#import "MPParsedExpression.h"
|
||||
|
||||
#import "MPTokenStream.h"
|
||||
#import "MPToken.h"
|
||||
|
||||
#import "MPExpression.h"
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
|
||||
@class MPWhiteView;
|
||||
|
||||
|
||||
@interface MPWhiteView : NSView
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#import "MPWhiteView.h"
|
||||
|
||||
|
||||
|
||||
@implementation MPWhiteView
|
||||
|
||||
- (void)drawRect:(NSRect)dirtyRect {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>ATSApplicationFontsPath</key>
|
||||
<string>Fonts</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
@@ -42,7 +44,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<string>42</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.education</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
@@ -51,8 +53,6 @@
|
||||
<string>Copyright © 2014 Kim Wittenburg. All rights reserved.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>ATSApplicationFontsPath</key>
|
||||
<string>Fonts</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
|
||||
@@ -63,11 +63,11 @@
|
||||
|
||||
/*!
|
||||
@method indexPathByPreceedingIndex:
|
||||
@brief Provides an index path with the given index followed by the
|
||||
@brief Provides an index path with the specified index followed by the
|
||||
indexes of the receiver.
|
||||
|
||||
@discussion If the receiver does not contain any indexes the given index is
|
||||
the only index contained in the returned index path.
|
||||
@discussion If the receiver does not contain any indexes the specified index
|
||||
is the only index contained in the returned index path.
|
||||
|
||||
@param index
|
||||
The index new index preceeding all others
|
||||
@@ -109,7 +109,7 @@
|
||||
/*!
|
||||
@method indexPathByRemovingIndexesFrom:
|
||||
@brief Provides an index path with the indexes in the recieving index
|
||||
path up to the index at the given position.
|
||||
path up to the index at the specified position.
|
||||
|
||||
@discussion If @c from is greater or equal to the number of indexes in the
|
||||
receiving index path only the indexes to the end of the receiver
|
||||
@@ -147,7 +147,7 @@
|
||||
/*!
|
||||
@method commonIndexPathWith:
|
||||
@brief Provides an index path that contains the first indexes of the
|
||||
receiver that are equal to the given index path.
|
||||
receiver that are equal to the specified index path.
|
||||
|
||||
@discussion If one index path is completely included in the other a new index
|
||||
path is returned that is equal to the contained index path.
|
||||
|
||||
@@ -1,29 +1,37 @@
|
||||
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
|
||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\paperw9840\paperh8400
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
|
||||
\paperw11904\paperh16836\vieww9600\viewh8400\viewkind0
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f0\b\fs24 \cf0 Engineering:
|
||||
\f0\fs24 \cf0 This application was created by Kim Wittenburg as part of the final exam.
|
||||
\b \
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720
|
||||
\cf0 \
|
||||
Engineering:
|
||||
\b0 \
|
||||
Some people\
|
||||
Kim Wittenburg\
|
||||
\
|
||||
|
||||
\b Human Interface Design:
|
||||
\b0 \
|
||||
Some other people\
|
||||
Kim Wittenburg\
|
||||
\
|
||||
|
||||
\b Testing:
|
||||
\b0 \
|
||||
Hopefully not nobody\
|
||||
Kim Wittenburg\
|
||||
Vincent Bettaque\
|
||||
Nils Burmeister\
|
||||
Jonas Rittmeyer\
|
||||
\
|
||||
|
||||
\b Documentation:
|
||||
\b0 \
|
||||
Whoever\
|
||||
Kim Wittenburg\
|
||||
\
|
||||
|
||||
\b With special thanks to:
|
||||
\b0 \
|
||||
Mom\
|
||||
13n, Gymnasium Wentorf\
|
||||
}
|
||||
Reference in New Issue
Block a user