Permalink
Browse files

Move percent-sign-as-mod #define to external header

  • Loading branch information...
1 parent 0bff4ee commit 43112f1f49dd683b9e7e58ea4b7c166325025abd @davedelong committed Dec 17, 2011
@@ -58,6 +58,8 @@
556C293A13CD42A8005203F1 /* _DDFunctionTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 556C293913CD42A8005203F1 /* _DDFunctionTerm.m */; };
556C293D13CD42F4005203F1 /* _DDNumberTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 556C293C13CD42F4005203F1 /* _DDNumberTerm.m */; };
556C294013CD42FF005203F1 /* _DDVariableTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 556C293F13CD42FE005203F1 /* _DDVariableTerm.m */; };
+ 556E126C149D2D4F00859AD8 /* DDParserTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 551C8C49144E5CFC00520BDA /* DDParserTypes.m */; };
+ 556E126D149D2D5000859AD8 /* DDParserTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 551C8C49144E5CFC00520BDA /* DDParserTypes.m */; };
557067B813CC0D19004CB1B2 /* _DDParserTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 557067B713CC0D19004CB1B2 /* _DDParserTerm.m */; };
55ABBAAB142ECB1300BDF29A /* _DDRewriteRule.m in Sources */ = {isa = PBXBuildFile; fileRef = 55ABBAAA142ECB1300BDF29A /* _DDRewriteRule.m */; };
55BA67A01299FA19002279A5 /* NSString+DDMathParsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 55BA679F1299FA19002279A5 /* NSString+DDMathParsing.m */; };
@@ -504,6 +506,7 @@
550C416A13BA8BCA00A041BC /* DDMathStringTokenizer.m in Sources */,
55F99B301434FA9A00817F7A /* _DDRewriteRule.m in Sources */,
554243591437654800BA293D /* _DDOperatorInfo.m in Sources */,
+ 556E126C149D2D4F00859AD8 /* DDParserTypes.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -535,6 +538,7 @@
550C416913BA8BCA00A041BC /* DDMathStringTokenizer.m in Sources */,
55F99B2F1434FA9900817F7A /* _DDRewriteRule.m in Sources */,
554243581437654800BA293D /* _DDOperatorInfo.m in Sources */,
+ 556E126D149D2D5000859AD8 /* DDParserTypes.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -40,3 +40,8 @@
#endif
+// change this to 0 if you want the "%" character to mean a percentage
+// please see the wiki for more information about what this switch means:
+// https://github.com/davedelong/DDMathParser/wiki
+#define DD_INTERPRET_PERCENT_SIGN_AS_MOD 0
+
@@ -7,7 +7,7 @@
//
#import <Foundation/Foundation.h>
-#import "DDExpression_Internal.h"
+#import "DDExpression.h"
@interface _DDFunctionExpression : DDExpression {
NSString * function;
@@ -8,8 +8,6 @@
#import "_DDOperatorInfo.h"
-#define PERCENT_AS_MOD 1
-
@implementation _DDOperatorInfo
@synthesize arity=_arity;
@@ -166,7 +164,7 @@ + (NSArray *)_buildOperators {
[operators addObject:[self infoForOperatorFunction:DDOperatorDivide token:@"\u00f7" arity:DDOperatorArityBinary precedence:precedence associativity:DDOperatorAssociativityLeft]];
precedence++;
-#if PERCENT_AS_MOD
+#if DD_INTERPRET_PERCENT_SIGN_AS_MOD
[operators addObject:[self infoForOperatorFunction:DDOperatorModulo token:@"%" arity:DDOperatorArityBinary precedence:precedence associativity:DDOperatorAssociativityLeft]];
precedence++;
#endif
@@ -188,7 +186,7 @@ + (NSArray *)_buildOperators {
// \u00b0 is °
[operators addObject:[self infoForOperatorFunction:DDOperatorDegree token:@"\u00b0" arity:DDOperatorArityUnary precedence:precedence associativity:DDOperatorAssociativityLeft]];
-#if !PERCENT_AS_MOD
+#if !DD_INTERPRET_PERCENT_SIGN_AS_MOD
[operators addObject:[self infoForOperatorFunction:DDOperatorPercent token:@"%" arity:DDOperatorArityUnary precedence:precedence associativity:DDOperatorAssociativityLeft]];
#endif

0 comments on commit 43112f1

Please sign in to comment.