libregexis024/src/libregexis024tools/delayed_matching.cpp

20 lines
745 B
C++

#include "delayed_matching.h"
#include <libregexis024sol/expr_compiler.h>
namespace regexis024 {
int compile(const std::string& regexp, track_var_list &ret_track_var_list, std::vector<uint8_t> &ret_program,
std::string &ret_message) {
ret_message.clear();
REGEX_IS024_MeaningContext cmp_ctx(regexp.size(), regexp.data());
if (cmp_ctx.error) {
ret_message = std::move(cmp_ctx.error_msg);
return -1;
}
ret_program = std::move(cmp_ctx.compiled_program);
ret_track_var_list.clear();
for (auto& iip: cmp_ctx.ktr.track_names)
ret_track_var_list[iip.first] = (TrackingVariableInfo)cmp_ctx.ktr.retrieval_info[iip.second];
return 0;
}
}