| 1376 | rhs_value parse_rhs_value(agent* thisAgent); |
| 1377 | |
| 1378 | rhs_value parse_function_call_after_lparen(agent* thisAgent, |
| 1379 | bool is_stand_alone_action) |
| 1380 | { |
| 1381 | rhs_function* rf; |
| 1382 | Symbol* fun_name; |
| 1383 | list* fl; |
| 1384 | cons* c, *prev_c; |
| 1385 | rhs_value arg_rv; |
| 1386 | int num_args; |
| 1387 | |
| 1388 | /* --- read function name, find the rhs_function structure --- */ |
| 1389 | if (thisAgent->lexeme.type == PLUS_LEXEME) |
| 1390 | { |
| 1391 | fun_name = find_str_constant(thisAgent, "+"); |
| 1392 | } |
| 1393 | else if (thisAgent->lexeme.type == MINUS_LEXEME) |
| 1394 | { |
| 1395 | fun_name = find_str_constant(thisAgent, "-"); |
| 1396 | } |
| 1397 | else |
| 1398 | { |
| 1399 | fun_name = find_str_constant(thisAgent, thisAgent->lexeme.string); |
| 1400 | } |
| 1401 | |
| 1402 | if (!fun_name && (std::string(thisAgent->lexeme.string) == "succeeded" || std::string(thisAgent->lexeme.string) == "failed")) |
| 1403 | { |
| 1404 | print(thisAgent, "WARNING: Replacing function named %s with halt since this is a unit test but running in a non-unit testing environment.\n", thisAgent->lexeme.string); |
| 1405 | fun_name = find_str_constant(thisAgent, "halt"); |
| 1406 | } |
| 1407 | |
| 1408 | if (!fun_name) |
| 1409 | { |
| 1410 | print(thisAgent, "No RHS function named %s\n", thisAgent->lexeme.string); |
| 1411 | print_location_of_most_recent_lexeme(thisAgent); |
| 1412 | return NIL; |
| 1413 | } |
| 1414 | rf = lookup_rhs_function(thisAgent, fun_name); |
| 1415 | |
| 1416 | if (!rf && (std::string(thisAgent->lexeme.string) == "succeeded" || std::string(thisAgent->lexeme.string) == "failed")) |
| 1417 | { |
| 1418 | print(thisAgent, "WARNING: Replacing function named %s with halt since this is a unit test but running in a non-unit testing environment.\n", thisAgent->lexeme.string); |
| 1419 | rf = lookup_rhs_function(thisAgent, find_str_constant(thisAgent, "halt")); |
| 1420 | } |
| 1421 | |
| 1422 | if (!rf) |
| 1423 | { |
| 1424 | print(thisAgent, "No RHS function named %s\n", thisAgent->lexeme.string); |
| 1425 | print_location_of_most_recent_lexeme(thisAgent); |
| 1426 | return NIL; |
| 1427 | } |
| 1428 | |
| 1429 | /* --- make sure stand-alone/rhs_value is appropriate --- */ |
| 1430 | if (is_stand_alone_action && (! rf->can_be_stand_alone_action)) |
| 1431 | { |
| 1432 | print(thisAgent, "Function %s cannot be used as a stand-alone action\n", |
| 1433 | thisAgent->lexeme.string); |
| 1434 | print_location_of_most_recent_lexeme(thisAgent); |
| 1435 | return NIL; |
no test coverage detected