Handle * and / operators */
| 392 | |
| 393 | /* Handle * and / operators */ |
| 394 | static Condition* Term(const char** str) |
| 395 | { |
| 396 | Condition* t; |
| 397 | Condition* t1; |
| 398 | Condition* mid; |
| 399 | |
| 400 | t = new Condition(); |
| 401 | |
| 402 | if (t == nullptr) |
| 403 | { |
| 404 | return NULL; |
| 405 | } |
| 406 | |
| 407 | if (!Primitive(str, t)) |
| 408 | { |
| 409 | delete t; |
| 410 | return 0; |
| 411 | } |
| 412 | |
| 413 | while (next == '*' || next == '/') |
| 414 | { |
| 415 | int op = next == '*' ? OP_MULT : OP_DIV; |
| 416 | |
| 417 | scan(str); |
| 418 | |
| 419 | if ((t1 = new Condition()) == nullptr) |
| 420 | { |
| 421 | delete t; |
| 422 | return nullptr; |
| 423 | } |
| 424 | |
| 425 | if (!Primitive(str, t1)) |
| 426 | { |
| 427 | delete t; |
| 428 | delete t1; |
| 429 | return 0; |
| 430 | } |
| 431 | |
| 432 | if ((mid = new Condition()) == nullptr) |
| 433 | { |
| 434 | delete t; |
| 435 | delete t1; |
| 436 | return nullptr; |
| 437 | } |
| 438 | |
| 439 | mid->lhs = t; |
| 440 | mid->rhs = t1; |
| 441 | mid->op = op; |
| 442 | |
| 443 | t = mid; |
| 444 | } |
| 445 | |
| 446 | return t; |
| 447 | } |
| 448 | |
| 449 | /* Check for + and - operators */ |
| 450 | static int SumOperators(const char** str) |