Implement exclusion operator matching.

This commit is contained in:
Danila Fedorin 2018-02-08 18:41:36 -08:00
parent eecfe653e3
commit 17ab9beb71
1 changed files with 6 additions and 1 deletions

View File

@ -130,10 +130,15 @@ int _eval_node_matches(pattern_node *node, eval *eval){
}
int _eval_foreach_check_node(void *data, va_list args){
int inverted_matches = 1;
int return_code = 0;
pattern_node* node = data;
eval* evl = va_arg(args, eval*);
if(_eval_node_matches(node, evl)){
while(node && node->invert && inverted_matches) {
inverted_matches &= !_eval_node_matches(node, evl);
node = _eval_pattern_node_get_next(node);
}
if(inverted_matches && _eval_node_matches(node, evl)){
return_code = _eval_pairmap_add_node(evl->set_next, _eval_pattern_node_get_next(node)) == LIBLEX_SUCCESS ? 0 : EVAL_FOREACH_MALLOC;
if(return_code == 0){
evl->matched++;