37 lines
661 B
Objective-C
37 lines
661 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"
|
|
|
|
@implementation MPParenthesisFunction
|
|
|
|
MPFunctionAccessorImplementation(Expression, _expression)
|
|
|
|
- (NSArray *)childrenAccessors
|
|
{
|
|
return @[@"expression"];
|
|
}
|
|
|
|
- (BOOL)validate:(MPParseError *__autoreleasing *)error
|
|
{
|
|
return [[self.expression parse] validate:error];
|
|
}
|
|
|
|
- (NSDecimalNumber *)evaluate
|
|
{
|
|
return [[self.expression parse] evaluate];
|
|
}
|
|
|
|
- (NSString *)description
|
|
{
|
|
return [NSString stringWithFormat:@"(%@)", self.expression.description];
|
|
}
|
|
|
|
@end
|