return roseCallback_i(start, end, id, ctxt) & t->floating_group_mask;
}
-/**
- * \brief Match callback adaptor used for matches from pure-literal cases.
- *
- * Literal match IDs in this path run limited Rose programs that do not use
- * Rose state (which is not initialised in the pure-literal path). They can
- * still, for example, check lookarounds or literal masks.
- */
-hwlmcb_rv_t rosePureLiteralCallback(size_t start, size_t end, u32 id,
- void *context) {
- DEBUG_PRINTF("start=%zu, end=%zu, id=%u\n", start, end, id);
- struct hs_scratch *scratch = context;
- struct core_info *ci = &scratch->core_info;
- const u64a real_end = (u64a)end + ci->buf_offset + 1;
- const u64a som = 0;
- const size_t match_len = end - start + 1;
- const struct RoseEngine *rose = ci->rose;
- const u32 *programs = getByOffset(rose, rose->litProgramOffset);
- assert(id < rose->literalCount);
- const u8 flags = 0;
- return roseRunProgram(rose, scratch, programs[id], som, real_end, match_len,
- flags);
-}
-
/**
* \brief Execute a boundary report program.
*
void roseStreamEodExec(const struct RoseEngine *t, u64a offset,
struct hs_scratch *scratch);
-hwlmcb_rv_t rosePureLiteralCallback(size_t start, size_t end, u32 id,
- void *context);
+hwlmcb_rv_t roseCallback(size_t start, size_t end, u32 id, void *context);
int roseReportAdaptor(u64a start, u64a end, ReportID id, void *context);
size_t length = scratch->core_info.len;
DEBUG_PRINTF("rose engine %d\n", rose->runtimeImpl);
- hwlmExec(ftable, buffer, length, 0, rosePureLiteralCallback, scratch,
+ // RoseContext values that need to be set for use by roseCallback.
+ scratch->tctxt.groups = rose->initialGroups;
+ scratch->tctxt.lit_offset_adjust = 1;
+
+ hwlmExec(ftable, buffer, length, 0, roseCallback, scratch,
rose->initialGroups);
}
DEBUG_PRINTF("::: streaming rose ::: offset = %llu len = %zu\n",
stream_state->offset, scratch->core_info.len);
+ // RoseContext values that need to be set for use by roseCallback.
+ scratch->tctxt.groups = loadGroups(rose, scratch->core_info.state);
+ scratch->tctxt.lit_offset_adjust = scratch->core_info.buf_offset + 1;
+
// Pure literal cases don't have floatingMinDistance set, so we always
// start the match region at zero.
const size_t start = 0;
- hwlmExecStreaming(ftable, scratch, len2, start, rosePureLiteralCallback,
+ hwlmExecStreaming(ftable, scratch, len2, start, roseCallback,
scratch, rose->initialGroups, hwlm_stream_state);
if (!told_to_stop_matching(scratch) &&