mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
ensure that engines added to the leftQueueMap are real rather than lookarounds
This commit is contained in:
parent
aa4ae755d8
commit
894e6835e6
@ -133,6 +133,8 @@ namespace ue2 {
|
|||||||
|
|
||||||
namespace /* anon */ {
|
namespace /* anon */ {
|
||||||
|
|
||||||
|
static constexpr u32 INVALID_QUEUE = ~0U;
|
||||||
|
|
||||||
struct left_build_info {
|
struct left_build_info {
|
||||||
// Constructor for an engine implementation.
|
// Constructor for an engine implementation.
|
||||||
left_build_info(u32 q, u32 l, u32 t, rose_group sm,
|
left_build_info(u32 q, u32 l, u32 t, rose_group sm,
|
||||||
@ -146,7 +148,7 @@ struct left_build_info {
|
|||||||
explicit left_build_info(const vector<vector<LookEntry>> &looks)
|
explicit left_build_info(const vector<vector<LookEntry>> &looks)
|
||||||
: has_lookaround(true), lookaround(looks) {}
|
: has_lookaround(true), lookaround(looks) {}
|
||||||
|
|
||||||
u32 queue = 0; /* uniquely idents the left_build_info */
|
u32 queue = INVALID_QUEUE; /* uniquely idents the left_build_info */
|
||||||
u32 lag = 0;
|
u32 lag = 0;
|
||||||
u32 transient = 0;
|
u32 transient = 0;
|
||||||
rose_group squash_mask = ~rose_group{0};
|
rose_group squash_mask = ~rose_group{0};
|
||||||
@ -155,6 +157,7 @@ struct left_build_info {
|
|||||||
u8 countingMiracleCount = 0;
|
u8 countingMiracleCount = 0;
|
||||||
CharReach countingMiracleReach;
|
CharReach countingMiracleReach;
|
||||||
u32 countingMiracleOffset = 0; /* populated later when laying out bytecode */
|
u32 countingMiracleOffset = 0; /* populated later when laying out bytecode */
|
||||||
|
/* leftfix can be completely implemented with lookaround */
|
||||||
bool has_lookaround = false;
|
bool has_lookaround = false;
|
||||||
vector<vector<LookEntry>> lookaround; // alternative implementation to the NFA
|
vector<vector<LookEntry>> lookaround; // alternative implementation to the NFA
|
||||||
};
|
};
|
||||||
@ -5693,6 +5696,11 @@ map<left_id, u32> makeLeftQueueMap(const RoseGraph &g,
|
|||||||
const map<RoseVertex, left_build_info> &leftfix_info) {
|
const map<RoseVertex, left_build_info> &leftfix_info) {
|
||||||
map<left_id, u32> lqm;
|
map<left_id, u32> lqm;
|
||||||
for (const auto &e : leftfix_info) {
|
for (const auto &e : leftfix_info) {
|
||||||
|
if (e.second.has_lookaround) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DEBUG_PRINTF("%zu: using queue %u\n", g[e.first].index, e.second.queue);
|
||||||
|
assert(e.second.queue != INVALID_QUEUE);
|
||||||
left_id left(g[e.first].left);
|
left_id left(g[e.first].left);
|
||||||
assert(!contains(lqm, left) || lqm[left] == e.second.queue);
|
assert(!contains(lqm, left) || lqm[left] == e.second.queue);
|
||||||
lqm[left] = e.second.queue;
|
lqm[left] = e.second.queue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user