111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/* Substitute variables and convert to RPN first */
tokens = [OFMutableArray array];
operators = [OFMutableArray array];
for (OFString *token in [condition
componentsSeparatedByString: @" "
options: OF_STRING_SKIP_EMPTY]) {
unsigned precedence;
if ([token isEqual: @"("]) {
[operators addObject: @"("];
continue;
}
if ([token isEqual: @")"]) {
|
>
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/* Substitute variables and convert to RPN first */
tokens = [OFMutableArray array];
operators = [OFMutableArray array];
for (OFString *token in [condition
componentsSeparatedByString: @" "
options: OF_STRING_SKIP_EMPTY]) {
unsigned precedence;
of_unichar_t c;
if ([token isEqual: @"("]) {
[operators addObject: @"("];
continue;
}
if ([token isEqual: @")"]) {
|
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
[operators removeLastObject];
}
[operators addObject: token];
continue;
}
of_unichar_t c = [token characterAtIndex: 0];
if ((c < '0' || c > '9') && c != '-')
if ((token = [variables objectForKey: token]) == nil)
@throw [OFInvalidFormatException exception];
[tokens addObject:
[OFNumber numberWithDouble: token.doubleValue]];
}
|
|
<
|
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
[operators removeLastObject];
}
[operators addObject: token];
continue;
}
c = [token characterAtIndex: 0];
if ((c < '0' || c > '9') && c != '-')
if ((token = [variables objectForKey: token]) == nil)
@throw [OFInvalidFormatException exception];
[tokens addObject:
[OFNumber numberWithDouble: token.doubleValue]];
}
|