Archived
1

Added Lots of Documentation

Added some nice to haves
Improved and Unified General Code Layout
This commit is contained in:
Kim Wittenburg
2015-01-04 02:54:27 +01:00
parent 152b981e24
commit 7438fd1f95
83 changed files with 2282 additions and 416 deletions

View File

@@ -8,6 +8,28 @@
#import "MPTerm.h"
/*!
@header
This file contains the <code>MPFunctionTerm</code> class.
*/
/*!
@define MPEvaluateExpression
@abstract Evaluates the receiver's child at the specified index and assigns
the evaluation result to a variable.
@discussion If errors occur during evaluation this macro returns
<code>nil</code>. Also there has to exist a <code>NSError *__autoreleasing *</code> pointer called <code>error</code>.
@param var
The name of the variable that will be declared in this macro. It
will be of the type <code>NSDecimalNumber *</code> and contain
the result of the evaluation.
@param index
The index of the child to be evaluated.
*/
#define MPEvaluateExpression(var, index) NSDecimalNumber *var = [[self expressionAtIndex:index] evaluate:error]; if (var == nil) return nil
@@ -15,11 +37,62 @@
@class MPFunctionTerm, MPFunction, MPParsedExpression;
/*!
@class MPFunctionTerm
@abstract A function term represents the term of a generic function.
@discussion This class is an abstract class that can not be evaluated. It is
the common superclass of all terms that represent <code>@link
//apple_ref/occ/cl/MPFunction@/link</code> instances.
*/
@interface MPFunctionTerm : MPTerm
/*!
@method initWithFunction:errors:
@abstract Initializes a <code>MPFunctionTerm</code> from the specified
<code>@link //apple_ref/occ/cl/MPFunction@/link</code> instance.
@discussion This method parses the children of the specified
<code>function</code> and stores the respective parsed
expressions. They are accessible using the <code>@link
//apple_ref/occ/instm/MPFunctionTerm/expressionAtIndex:@/link</code>
method.
Whether the children should contain a variable definition is
determined using the <code>@link
//apple_ref/occ/instm/MPFunction/expectsVariableDefinitionInChildAtIndex:@/link</code>
@param function
The function to initialize the receiver with. This method parses
the function's children. If any of them contain syntax errors
they are returned indirectly through the <code>errors</code>
parameter.
@param errors
If any of the <code>function</code>'s children contain syntax
errors they are returned indirectly through this parameter. In
that case the method returns <code>nil</code>. If there are no
errors the parameter is not modified. This parameter is never set
to an empty array.
@return A new <code>MPFunctionTerm</code> instance.
*/
- (instancetype)initWithFunction:(MPFunction *)function
errors:(NSArray *__autoreleasing *)errors; /* designated initializer */
/*!
@method expressionAtIndex:
@abstract Returns a <code>@link
//apple_ref/occ/cl/MPParsedExpression@/link</code> instance that
represents the child at <code>anIndex</code> of the function that
is represented by the receiver.
@param anIndex
The index of the child.
@return A parsed expression that represents th
*/
- (MPParsedExpression *)expressionAtIndex:(NSUInteger)anIndex;
@end