--- Read and consume one pattern element. Return 0 if error, 1 if "*", otherwise return 2 and set dest_sym to find_symbol() result. --- */
| 475 | /* --- Read and consume one pattern element. Return 0 if error, 1 if "*", |
| 476 | otherwise return 2 and set dest_sym to find_symbol() result. --- */ |
| 477 | int read_pattern_component(agent* thisAgent, Symbol** dest_sym) |
| 478 | { |
| 479 | if (strcmp(thisAgent->lexeme.string, "*") == 0) |
| 480 | { |
| 481 | return 1; |
| 482 | } |
| 483 | switch (thisAgent->lexeme.type) |
| 484 | { |
| 485 | case SYM_CONSTANT_LEXEME: |
| 486 | *dest_sym = find_str_constant(thisAgent, thisAgent->lexeme.string); |
| 487 | return 2; |
| 488 | case INT_CONSTANT_LEXEME: |
| 489 | *dest_sym = find_int_constant(thisAgent, thisAgent->lexeme.int_val); |
| 490 | return 2; |
| 491 | case FLOAT_CONSTANT_LEXEME: |
| 492 | *dest_sym = find_float_constant(thisAgent, thisAgent->lexeme.float_val); |
| 493 | return 2; |
| 494 | case IDENTIFIER_LEXEME: |
| 495 | *dest_sym = find_identifier(thisAgent, thisAgent->lexeme.id_letter, thisAgent->lexeme.id_number); |
| 496 | return 2; |
| 497 | case VARIABLE_LEXEME: |
| 498 | *dest_sym = read_identifier_or_context_variable(thisAgent); |
| 499 | if (*dest_sym) |
| 500 | { |
| 501 | return 2; |
| 502 | } |
| 503 | return 0; |
| 504 | default: |
| 505 | print(thisAgent, "Expected identifier or constant in wme pattern\n"); |
| 506 | return 0; |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | list* read_pattern_and_get_matching_wmes(agent* thisAgent) |
| 511 | { |
no test coverage detected