mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-30 19:47:43 +03:00
chimera: hybrid of Hyperscan and PCRE
This commit is contained in:
@@ -76,6 +76,7 @@ void usage(const char *name, const char *error) {
|
||||
"blocks.\n");
|
||||
printf(" -V NUM Use vectored mode, split data into ~NUM "
|
||||
"blocks.\n");
|
||||
printf(" -H Use hybrid mode.\n");
|
||||
printf(" -Z {R or 0-%d} Only test one alignment, either as given or "
|
||||
"'R' for random.\n", MAX_MAX_UE2_ALIGN - 1);
|
||||
printf(" -q Quiet; display only match differences, no other "
|
||||
@@ -90,6 +91,7 @@ void usage(const char *name, const char *error) {
|
||||
printf(" -E DISTANCE Match all patterns within edit distance"
|
||||
" DISTANCE.\n");
|
||||
printf(" --prefilter Apply HS_FLAG_PREFILTER to all patterns.\n");
|
||||
printf(" --no-groups Disable capturing in Hybrid mode.\n");
|
||||
printf("\n");
|
||||
printf("Testing mode options:\n");
|
||||
printf("\n");
|
||||
@@ -157,7 +159,7 @@ void processArgs(int argc, char *argv[], CorpusProperties &corpus_gen_prop,
|
||||
vector<string> *corpora, UNUSED Grey *grey,
|
||||
unique_ptr<hs_platform_info> *plat_out) {
|
||||
static const char options[]
|
||||
= "-ab:cC:d:D:e:E:G:hi:k:Lm:M:n:o:O:p:P:qr:R:S:s:t:T:vV:w:x:X:Y:z:Z:8";
|
||||
= "-ab:cC:d:D:e:E:G:hHi:k:Lm:M:n:o:O:p:P:qr:R:S:s:t:T:vV:w:x:X:Y:z:Z:8";
|
||||
s32 in_multi = 0;
|
||||
s32 in_corpora = 0;
|
||||
int pcreFlag = 1;
|
||||
@@ -180,6 +182,7 @@ void processArgs(int argc, char *argv[], CorpusProperties &corpus_gen_prop,
|
||||
{"no-signal-handler", 0, &no_signal_handler, 1},
|
||||
{"compress-expand", 0, &compressFlag, 1},
|
||||
{"compress-reset-expand", 0, &compressResetFlag, 1},
|
||||
{"no-groups", 0, &no_groups, 1},
|
||||
{nullptr, 0, nullptr, 0}};
|
||||
|
||||
for (;;) {
|
||||
@@ -271,6 +274,15 @@ void processArgs(int argc, char *argv[], CorpusProperties &corpus_gen_prop,
|
||||
case 'h':
|
||||
usage(argv[0], nullptr);
|
||||
exit(0);
|
||||
case 'H':
|
||||
if (colliderMode != MODE_BLOCK) {
|
||||
usage(argv[0], "You can only use one mode at a time!");
|
||||
exit(1);
|
||||
}
|
||||
colliderMode = MODE_HYBRID;
|
||||
// Disable graph truth in hybrid mode
|
||||
nfaFlag = 0;
|
||||
break;
|
||||
case 'i':
|
||||
loadDatabases = true;
|
||||
serializePath = optarg;
|
||||
@@ -542,6 +554,11 @@ void processArgs(int argc, char *argv[], CorpusProperties &corpus_gen_prop,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (colliderMode == MODE_HYBRID && !ue2Flag) {
|
||||
usage(argv[0], "You cannot disable UE2 engine in Hybrid mode.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// need at least two pattern engines active
|
||||
if (nfaFlag + pcreFlag + ue2Flag < 2) {
|
||||
usage(argv[0], "At least two pattern engines should be active.");
|
||||
|
Reference in New Issue
Block a user