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

Function parse_attr_value_make

Core/SoarKernel/src/parser.cpp:1934–2046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1932----------------------------------------------------------------- */
1933
1934action* parse_attr_value_make(agent* thisAgent, Symbol* id)
1935{
1936 rhs_value attr, value;
1937 action* all_actions, *new_actions, *last;
1938 Symbol* old_id, *new_var;
1939
1940 /* JC Added, need to store the attribute name */
1941 char szAttribute[256];
1942
1943 if (thisAgent->lexeme.type != UP_ARROW_LEXEME)
1944 {
1945 print(thisAgent, "Expected ^ in RHS make action\n");
1946 print_location_of_most_recent_lexeme(thisAgent);
1947 return NIL;
1948 }
1949 old_id = id;
1950
1951 get_lexeme(thisAgent); /* consume up-arrow, advance to attribute */
1952 attr = parse_rhs_value(thisAgent);
1953 if (! attr)
1954 {
1955 return NIL;
1956 }
1957
1958 /* JC Added, we will need the attribute as a string, so we get it here */
1959 rhs_value_to_string(attr, szAttribute, 256);
1960
1961 all_actions = NIL;
1962
1963 /* allow dot notation "." in RHS attribute path 10/15/98 KJC */
1964 while (thisAgent->lexeme.type == PERIOD_LEXEME)
1965 {
1966 get_lexeme(thisAgent); /* consume the "." */
1967
1968 /* set up for next attribute in path: make dummy variable,
1969 and create new action in the path */
1970 new_var = make_placeholder_var(thisAgent, first_letter_from_rhs_value(attr));
1971
1972 /* parse_preferences actually creates the action. Even though
1973 there aren't really any preferences to read, we need the default
1974 acceptable prefs created for all attributes in path */
1975
1976 if (strcmp(szAttribute, "operator") != 0)
1977 {
1978 new_actions = parse_preferences_soar8_non_operator(thisAgent, id, attr,
1979 symbol_to_rhs_value(new_var));
1980 }
1981 else
1982 {
1983 new_actions = parse_preferences(thisAgent, id, attr, symbol_to_rhs_value(new_var));
1984 }
1985
1986 for (last = new_actions; last->next != NIL; last = last->next)
1987 /* continue */;
1988
1989 last->next = all_actions;
1990 all_actions = new_actions;
1991

Callers 1

parse_rhs_actionFunction · 0.85

Calls 13

printFunction · 0.85
get_lexemeFunction · 0.85
parse_rhs_valueFunction · 0.85
rhs_value_to_stringFunction · 0.85
make_placeholder_varFunction · 0.85
symbol_to_rhs_valueFunction · 0.85
parse_preferencesFunction · 0.85
deallocate_rhs_valueFunction · 0.85
symbol_remove_refFunction · 0.85

Tested by

no test coverage detected