Implement matching strings + finding groups.

They're done in the same step.

result = _regex_find_all(root, &clear_ll, -1);
ll_clear(&clear_ll);

Is all that's necessary to reset all nodes, since the only value
that changes during the match is list_id, and that gets set when the
nodes are found.
This commit is contained in:
2017-01-08 00:04:31 -08:00
parent 06fe67b226
commit fbb0635b26
2 changed files with 129 additions and 2 deletions

View File

@@ -300,6 +300,7 @@ void regex_node_clear(regex_node* node);
/**
* Frees an entire NFA, starting from the given root node.
* @param root the root, or starting node, of the NFA.
* @return the result of the operation: LIBREGEX_SUCCESS if all goes well, or an error code.
*/
libregex_result regex_free(regex_node* root);
/**
@@ -317,5 +318,11 @@ libregex_result regex_build(regex_node** root, char* expression);
* @return the result of the operation: LIBREGEX_SUCCESS if all goes well, or an error code.
*/
libregex_result regex_match_string(regex_node* root, char* string, regex_result* result);
/**
* Frees data used by regex_match_string in a regex_result struct.
* The actual struct is not freed.
* @param result the result struct
*/
void regex_result_free(regex_result* result);
#endif