Implement the 'any' character.

This commit is contained in:
Danila Fedorin 2017-02-25 22:24:52 -08:00
parent f18a31c0df
commit 2cdd9e55be

View File

@ -328,6 +328,19 @@ liblex_result _pattern_build_chain(pattern_chain** into, int* ids, int pattern_i
result = _pattern_chain_create(&current_chain, NULL, NULL);
(*index)++;
}
} if(string[*index] == '.') {
pattern_node* new_node = NULL;
_pattern_chain_append_chain_discard(current_chain, &sub_chain);
result = _pattern_chain_create(&sub_chain, NULL, NULL);
if(result == LIBLEX_SUCCESS){
result = _pattern_node_create_any(&new_node, (*ids)++, pattern_id, NULL);
}
if(result == LIBLEX_SUCCESS){
sub_chain->head = sub_chain->tail = new_node;
(*index)++;
} else {
free(new_node);
}
} else {
char new_char = '\0';
pattern_node* new_node = NULL;