------------------------------------------------------------------------------
| 1235 | |
| 1236 | //------------------------------------------------------------------------------ |
| 1237 | void vtkFunctionParser::BuildInternalSubstringStructure(int beginIndex, int endIndex) |
| 1238 | { |
| 1239 | int mathFunctionNum, beginIndex2; |
| 1240 | int opNum, parenthesisCount, i; |
| 1241 | // in order of reverse precedence |
| 1242 | static const char* const elementaryMathOps = "|&=<>+-.*/^"; |
| 1243 | |
| 1244 | if (this->IsSubstringCompletelyEnclosed(beginIndex, endIndex)) |
| 1245 | { |
| 1246 | this->BuildInternalSubstringStructure(beginIndex + 1, endIndex - 1); |
| 1247 | return; |
| 1248 | } |
| 1249 | |
| 1250 | if (this->Function[beginIndex] == '-') |
| 1251 | { |
| 1252 | if (this->IsSubstringCompletelyEnclosed(beginIndex + 1, endIndex)) |
| 1253 | { |
| 1254 | this->BuildInternalSubstringStructure(beginIndex + 2, endIndex - 1); |
| 1255 | this->AddInternalByte(VTK_PARSER_UNARY_MINUS); |
| 1256 | return; |
| 1257 | } |
| 1258 | if (this->GetMathFunctionNumber(beginIndex + 1) > 0 && |
| 1259 | this->FindEndOfMathFunction(beginIndex + 1) == endIndex) |
| 1260 | { |
| 1261 | this->BuildInternalSubstringStructure(beginIndex + 1, endIndex); |
| 1262 | this->AddInternalByte(VTK_PARSER_UNARY_MINUS); |
| 1263 | return; |
| 1264 | } |
| 1265 | } |
| 1266 | |
| 1267 | if (this->Function[beginIndex] == '+') |
| 1268 | { |
| 1269 | if (this->IsSubstringCompletelyEnclosed(beginIndex + 1, endIndex)) |
| 1270 | { |
| 1271 | this->BuildInternalSubstringStructure(beginIndex + 2, endIndex - 1); |
| 1272 | this->AddInternalByte(VTK_PARSER_UNARY_PLUS); |
| 1273 | return; |
| 1274 | } |
| 1275 | if (this->GetMathFunctionNumber(beginIndex + 1) > 0 && |
| 1276 | this->FindEndOfMathFunction(beginIndex + 1) == endIndex) |
| 1277 | { |
| 1278 | this->BuildInternalSubstringStructure(beginIndex + 1, endIndex); |
| 1279 | this->AddInternalByte(VTK_PARSER_UNARY_PLUS); |
| 1280 | return; |
| 1281 | } |
| 1282 | } |
| 1283 | |
| 1284 | if (isalpha(this->Function[beginIndex])) |
| 1285 | { |
| 1286 | mathFunctionNum = this->GetMathFunctionNumber(beginIndex); |
| 1287 | if (mathFunctionNum > 0) |
| 1288 | { |
| 1289 | beginIndex2 = beginIndex + this->GetMathFunctionStringLength(mathFunctionNum); |
| 1290 | while (beginIndex2 <= endIndex && this->Function[beginIndex2] == ' ') |
| 1291 | { |
| 1292 | beginIndex2++; |
| 1293 | } |
| 1294 | if (this->IsSubstringCompletelyEnclosed(beginIndex2, endIndex)) |
no test coverage detected