Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

slightly more descriptive error

  • Loading branch information...
commit 4636edb365ec23da6c9082502575c79ce4bada8b 1 parent bf22144
Dave DeLong authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 DDMathParser/_DDOperatorTerm.m
10 DDMathParser/_DDOperatorTerm.m
View
@@ -33,7 +33,15 @@ - (NSString *)operatorFunction {
- (BOOL)resolveWithParser:(DDParser *)parser error:(NSError *__autoreleasing *)error {
#pragma unused(parser)
ERR_ASSERT(error);
- *error = ERR(DDErrorCodeOperatorMissingOperands, @"missing operand(s) for operator: %@", [self token]);
+ if ([self operatorArity] == DDOperatorArityUnary) {
+ if ([[self token] operatorAssociativity] == DDOperatorAssociativityLeft) {
+ *error = ERR(DDErrorCodeUnaryOperatorMissingLeftOperand, @"no left operand to unary %@", [self token]);
+ } else {
+ *error = ERR(DDErrorCodeUnaryOperatorMissingRightOperand, @"no right operand to unary %@", [self token]);
+ }
+ } else {
+ *error = ERR(DDErrorCodeOperatorMissingOperands, @"missing operands for operator: %@", [self token]);
+ }
return NO;
}
Please sign in to comment.
Something went wrong with that request. Please try again.