mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-12-31 13:49:07 +03:00
add new Literal API for pure literal expressions:
Design compile time api hs_compile_lit() and hs_compile_lit_multi() to handle pure literal pattern sets. Corresponding option --literal-on is added for hyperscan testing suites. Extended parameters and part of flags are not supported for this api.
This commit is contained in:
committed by
Chang, Harry
parent
8bfbf07f75
commit
23e5f06594
@@ -2843,34 +2843,9 @@ vector<LitFragment> groupByFragment(const RoseBuildImpl &build) {
|
||||
|
||||
DEBUG_PRINTF("fragment candidate: lit_id=%u %s\n", lit_id,
|
||||
dumpString(lit.s).c_str());
|
||||
|
||||
/** 0:/xxabcdefgh/ */
|
||||
/** 1:/yyabcdefgh/ */
|
||||
/** 2:/yyabcdefgh.+/ */
|
||||
// Above 3 patterns should firstly convert into RoseLiteralMap with
|
||||
// 2 elements ("xxabcdefgh" and "yyabcdefgh"), then convert into
|
||||
// LitFragment with 1 element ("abcdefgh"). Special care should be
|
||||
// taken to handle the 'pure' flag during the conversion.
|
||||
|
||||
rose_literal_id lit_frag = getFragment(lit);
|
||||
auto it = frag_info.find(lit_frag);
|
||||
if (it != frag_info.end()) {
|
||||
if (!lit_frag.s.get_pure() && it->first.s.get_pure()) {
|
||||
struct FragmentInfo f_info = it->second;
|
||||
f_info.lit_ids.push_back(lit_id);
|
||||
f_info.groups |= groups;
|
||||
frag_info.erase(it->first);
|
||||
frag_info.emplace(lit_frag, f_info);
|
||||
} else {
|
||||
it->second.lit_ids.push_back(lit_id);
|
||||
it->second.groups |= groups;
|
||||
}
|
||||
} else {
|
||||
struct FragmentInfo f_info;
|
||||
f_info.lit_ids.push_back(lit_id);
|
||||
f_info.groups |= groups;
|
||||
frag_info.emplace(lit_frag, f_info);
|
||||
}
|
||||
auto &fi = frag_info[getFragment(lit)];
|
||||
fi.lit_ids.push_back(lit_id);
|
||||
fi.groups |= groups;
|
||||
}
|
||||
|
||||
for (auto &m : frag_info) {
|
||||
|
||||
Reference in New Issue
Block a user