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

Function parse_attr_value_tests

Core/SoarKernel/src/parser.cpp:833–949  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

831----------------------------------------------------------------- */
832
833condition* parse_attr_value_tests(agent* thisAgent)
834{
835 test id_test_to_use, attr_test;
836 bool negate_it;
837 condition* first_c, *last_c, *c, *new_conds;
838
839 /* --- read optional minus sign --- */
840 negate_it = false;
841 if (thisAgent->lexeme.type == MINUS_LEXEME)
842 {
843 negate_it = true;
844 get_lexeme(thisAgent);
845 }
846
847 /* --- read up arrow --- */
848 if (thisAgent->lexeme.type != UP_ARROW_LEXEME)
849 {
850 print(thisAgent, "Expected ^ followed by attribute\n");
851 print_location_of_most_recent_lexeme(thisAgent);
852 return NIL;
853 }
854 get_lexeme(thisAgent);
855
856 first_c = NIL;
857 last_c = NIL;
858
859 /* --- read first <attr_test> --- */
860 attr_test = parse_test(thisAgent);
861 if (!attr_test)
862 {
863 return NIL;
864 }
865 if (! test_includes_equality_test_for_symbol(attr_test, NIL))
866 {
867 add_new_test_to_test(thisAgent, &attr_test, make_placeholder_test(thisAgent, 'a'));
868 }
869
870 /* --- read optional attribute path --- */
871 id_test_to_use = NIL;
872 while (thisAgent->lexeme.type == PERIOD_LEXEME)
873 {
874 get_lexeme(thisAgent); /* consume the "." */
875 /* --- setup for next attribute in path: make a dummy variable,
876 create a new condition in the path --- */
877 allocate_with_pool(thisAgent, &thisAgent->condition_pool, &c);
878 c->type = POSITIVE_CONDITION;
879 if (last_c)
880 {
881 last_c->next = c;
882 }
883 else
884 {
885 first_c = c;
886 }
887 c->next = NIL;
888 c->prev = last_c;
889 last_c = c;
890 if (id_test_to_use)

Callers 1

Calls 15

get_lexemeFunction · 0.85
printFunction · 0.85
parse_testFunction · 0.85
add_new_test_to_testFunction · 0.85
make_placeholder_testFunction · 0.85
allocate_with_poolFunction · 0.85
copy_testFunction · 0.85
first_letter_from_testFunction · 0.85
parse_value_test_starFunction · 0.85

Tested by

no test coverage detected