35 lines
778 B
Objective-C
35 lines
778 B
Objective-C
|
|
//
|
|
// MPParenthesisFunction.m
|
|
// MathPad
|
|
//
|
|
// Created by Kim Wittenburg on 17.09.14.
|
|
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
|
//
|
|
|
|
#import "MPParenthesisFunction.h"
|
|
#import "MPExpressionEvaluator.h"
|
|
|
|
@implementation MPParenthesisFunction
|
|
|
|
MPFunctionAccessorImplementation(Expression, _expression)
|
|
|
|
- (NSArray *)childrenAccessors
|
|
{
|
|
return @[@"expression"];
|
|
}
|
|
|
|
- (MPTerm *)parseWithError:(MPParseError *__autoreleasing *)error
|
|
{
|
|
MPExpressionEvaluator *evaluator = [[MPExpressionEvaluator alloc] initWithExpression:self.expression];
|
|
return [evaluator parseExpectingVariable:NO
|
|
error:error];
|
|
}
|
|
|
|
- (NSString *)description
|
|
{
|
|
return [NSString stringWithFormat:@"(%@)", self.expression.description];
|
|
}
|
|
|
|
@end
|