Fix bug(s) in pattern compilation that added the '[' pr ']' chars.

This commit is contained in:
Danila Fedorin 2017-02-04 00:29:20 -08:00
parent 0b6d73ebdf
commit 5be88a2856

View File

@ -203,6 +203,10 @@ liblex_result _pattern_build_or(pattern_chain** into, int* ids, int pattern_id,
result = _pattern_chain_create(into, NULL, tail_node);
}
if(result == LIBLEX_SUCCESS){
(*index)++;
}
while (string[*index] && string[*index] != ']' && result == LIBLEX_SUCCESS) {
char from = '\0';
char to = '\0';
@ -248,6 +252,8 @@ liblex_result _pattern_build_or(pattern_chain** into, int* ids, int pattern_id,
free(tail_node);
}
free(*into);
} else {
(*index)++;
}
return result;