mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
limex: add CANNOT_DIE flag and loop without test
This commit is contained in:
parent
7920b1086b
commit
8713cfbd9e
@ -2237,6 +2237,10 @@ struct Factory {
|
||||
limex->shiftCount = shiftCount;
|
||||
writeShiftMasks(args, limex);
|
||||
|
||||
if (hasInitDsStates(args.h, args.state_ids)) {
|
||||
setLimexFlag(limex, LIMEX_FLAG_CANNOT_DIE);
|
||||
}
|
||||
|
||||
// Determine the state required for our state vector.
|
||||
findStateSize(args, limex);
|
||||
|
||||
|
@ -85,6 +85,7 @@
|
||||
|
||||
#define LIMEX_FLAG_COMPRESS_STATE 1 /**< pack state into stream state */
|
||||
#define LIMEX_FLAG_COMPRESS_MASKED 2 /**< use reach mask-based compression */
|
||||
#define LIMEX_FLAG_CANNOT_DIE 4 /**< limex cannot have no states on */
|
||||
|
||||
enum LimExTrigger {
|
||||
LIMEX_TRIGGER_NONE = 0,
|
||||
|
@ -216,11 +216,32 @@ char STREAM_FN(const IMPL_NFA_T *limex, const u8 *input, size_t length,
|
||||
size_t min_accel_offset = 0;
|
||||
if (!limex->accelCount || length < ACCEL_MIN_LEN) {
|
||||
min_accel_offset = length;
|
||||
goto without_accel;
|
||||
if (limex->flags & LIMEX_FLAG_CANNOT_DIE) {
|
||||
goto cannot_die;
|
||||
} else {
|
||||
goto without_accel;
|
||||
}
|
||||
} else {
|
||||
goto with_accel;
|
||||
}
|
||||
|
||||
cannot_die:
|
||||
for (; i != min_accel_offset; i++) {
|
||||
DUMP_INPUT(i);
|
||||
|
||||
STATE_T succ;
|
||||
NFA_EXEC_GET_LIM_SUCC(limex, s, succ);
|
||||
|
||||
if (RUN_EXCEPTIONS_FN(limex, exceptions, s, EXCEPTION_MASK, i, offset,
|
||||
&succ, final_loc, ctx, flags, 0, first_match)) {
|
||||
return MO_HALT_MATCHING;
|
||||
}
|
||||
|
||||
u8 c = input[i];
|
||||
s = AND_STATE(succ, LOAD_FROM_ENG(&reach[limex->reachMap[c]]));
|
||||
}
|
||||
goto finished;
|
||||
|
||||
without_accel:
|
||||
for (; i != min_accel_offset; i++) {
|
||||
DUMP_INPUT(i);
|
||||
@ -292,6 +313,7 @@ with_accel:
|
||||
s = AND_STATE(succ, LOAD_FROM_ENG(&reach[limex->reachMap[c]]));
|
||||
}
|
||||
|
||||
finished:
|
||||
ctx->s = s;
|
||||
|
||||
if ((first_match || (flags & CALLBACK_OUTPUT)) && limex->acceptCount) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user