MCPcopy Create free account
hub / github.com/SoarGroup/Soar / parse_disjunction_test

Function parse_disjunction_test

Core/SoarKernel/src/parser.cpp:460–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458----------------------------------------------------------------- */
459
460test parse_disjunction_test(agent* thisAgent)
461{
462 complex_test* ct;
463 test t;
464
465 if (thisAgent->lexeme.type != LESS_LESS_LEXEME)
466 {
467 print(thisAgent, "Expected << to begin disjunction test\n");
468 print_location_of_most_recent_lexeme(thisAgent);
469 return NIL;
470 }
471 get_lexeme(thisAgent);
472
473 allocate_with_pool(thisAgent, &thisAgent->complex_test_pool, &ct);
474 ct->type = DISJUNCTION_TEST;
475 ct->data.disjunction_list = NIL;
476 t = make_test_from_complex_test(ct);
477
478 while (thisAgent->lexeme.type != GREATER_GREATER_LEXEME)
479 {
480 switch (thisAgent->lexeme.type)
481 {
482 case SYM_CONSTANT_LEXEME:
483 case INT_CONSTANT_LEXEME:
484 case FLOAT_CONSTANT_LEXEME:
485 push(thisAgent, make_symbol_for_current_lexeme(thisAgent, false), ct->data.disjunction_list);
486 get_lexeme(thisAgent);
487 break;
488 default:
489 print(thisAgent, "Expected constant or >> while reading disjunction test\n");
490 print_location_of_most_recent_lexeme(thisAgent);
491 deallocate_test(thisAgent, t);
492 return NIL;
493 }
494 }
495 get_lexeme(thisAgent); /* consume the >> */
496 ct->data.disjunction_list =
497 destructively_reverse_list(ct->data.disjunction_list);
498 return t;
499}
500
501/* -----------------------------------------------------------------
502 Parse Simple Test

Callers 1

parse_simple_testFunction · 0.85

Calls 9

printFunction · 0.85
get_lexemeFunction · 0.85
allocate_with_poolFunction · 0.85
pushFunction · 0.85
deallocate_testFunction · 0.85

Tested by

no test coverage detected