| 521 | ----------------------------------------------------------------- */ |
| 522 | |
| 523 | test parse_test(agent* thisAgent) |
| 524 | { |
| 525 | complex_test* ct; |
| 526 | test t, temp; |
| 527 | |
| 528 | if (thisAgent->lexeme.type != L_BRACE_LEXEME) |
| 529 | { |
| 530 | return parse_simple_test(thisAgent); |
| 531 | } |
| 532 | /* --- parse and return conjunctive test --- */ |
| 533 | get_lexeme(thisAgent); |
| 534 | t = make_blank_test(); |
| 535 | do |
| 536 | { |
| 537 | temp = parse_simple_test(thisAgent); |
| 538 | if (!temp) |
| 539 | { |
| 540 | deallocate_test(thisAgent, t); |
| 541 | return NIL; |
| 542 | } |
| 543 | add_new_test_to_test(thisAgent, &t, temp); |
| 544 | } |
| 545 | while (thisAgent->lexeme.type != R_BRACE_LEXEME); |
| 546 | get_lexeme(thisAgent); /* consume the "}" */ |
| 547 | |
| 548 | if (test_is_complex_test(t)) |
| 549 | { |
| 550 | ct = complex_test_from_test(t); |
| 551 | if (ct->type == CONJUNCTIVE_TEST) |
| 552 | ct->data.conjunct_list = |
| 553 | destructively_reverse_list(ct->data.conjunct_list); |
| 554 | } |
| 555 | |
| 556 | return t; |
| 557 | } |
| 558 | |
| 559 | /* ================================================================= |
| 560 | Routines for Conditions |
no test coverage detected