17 static uint32_t
unmap (Span * new_span,
const Span * old_span, uint32_t old_nspans,
const State * x);
20 : def (span_size == 0 ? NULL : span[span_size - 1].to)
21 , cases (new
Case[span_size])
24 for (uint32_t i = 0, lb = 0; i < span_size; ++ i)
26 add (lb, span[i].ub, span[i].to);
35 if (
cases[i].to == to)
37 cases[i].
ranges.push_back (std::make_pair (lb, ub));
56 const uint32_t l = n / 2;
57 const uint32_t h = n - l;
58 cond =
new Cond (
"<=", s[l - 1].ub - 1);
69 while (n >= 3 && s[2].to == bg && (s[1].ub - s[0].ub) == 1)
71 if (s[1].to == next && n == 3)
73 branches.push_back (std::make_pair (
new Cond (
"!=", s[0].ub), bg));
78 branches.push_back (std::make_pair (
new Cond (
"==", s[0].ub), s[1].to));
85 if (next == NULL || s[0].to != next)
87 branches.push_back (std::make_pair (static_cast<const Cond *> (NULL), s[0].to));
91 else if (n == 2 && bg == next)
93 branches.push_back (std::make_pair (
new Cond (
">=", s[0].ub), s[1].to));
98 branches.push_back (std::make_pair (
new Cond (
"<=", s[0].ub - 1), bg));
124 if ((!
opts->
sFlag && nsp > 2) || (nsp > 8 && (sp[nsp - 2].
ub - sp[0].
ub <= 3 * (nsp - 2))))
141 , bitmap_state (bm_state)
145 Span * bspan = allocate<Span> (nSpans);
146 uint32_t bSpans =
unmap (bspan, span, nSpans, bm_state);
149 :
new SwitchIf (bspan, bSpans, next);
155 operator delete (bspan);
161 : table (new const
State * [TABLE_SIZE])
164 for (uint32_t i = 0; i < nSpans; ++i)
174 : hgo (hSpans == 0 ? NULL : new
SwitchIf (hspan, hSpans, next))
180 , cases (new
Cases (sp, nsp))
199 const Span * hspan = NULL;
200 for (uint32_t i = 0; i <
nSpans; ++i)
202 if (
span[i].ub > 0x100)
211 uint32_t nBitmaps = 0;
213 const State * bitmap_state = NULL;
214 for (uint32_t i = 0; i <
nSpans; ++i)
216 if (
span[i].to->isBase)
224 bitmap_state =
span[i].
to;
231 const uint32_t dSpans = nSpans - hSpans - nBitmaps;
264 uint32_t new_nspans = 0;
265 for (uint32_t i = 0; i < old_nspans; ++i)
267 if (old_span[i].to != x)
269 if (new_nspans > 0 && new_span[new_nspans - 1].to == old_span[i].to)
270 new_span[new_nspans - 1].
ub = old_span[i].
ub;
273 new_span[new_nspans].
to = old_span[i].
to;
274 new_span[new_nspans].
ub = old_span[i].
ub;
280 new_span[new_nspans - 1].
ub = old_span[old_nspans - 1].
ub;
Cond(const std::string &cmp, uint32_t val)
static const uint32_t TABLE_SIZE
void init(const State *from)
Cpgoto(const Span *span, uint32_t nSpans, const Span *hspan, uint32_t hSpans, const State *next)
enum re2c::SwitchIf::@1 type
Dot(const Span *sp, uint32_t nsp, const State *from)
GoBitmap(const Span *span, uint32_t nSpans, const Span *hspan, uint32_t hSpans, const BitMap *bm, const State *bm_state, const State *next)
Linear(const Span *s, uint32_t n, const State *next)
SwitchIf(const Span *sp, uint32_t nsp, const State *next)
void add(uint32_t lb, uint32_t ub, State *to)
static uint32_t unmap(Span *new_span, const Span *old_span, uint32_t old_nspans, const State *x)
If(type_t t, const Span *sp, uint32_t nsp, const State *next)
std::vector< std::pair< const Cond *, const State * > > branches
CpgotoTable(const Span *span, uint32_t nSpans)
static const BitMap * find(const Go *, const State *)
Cases(const Span *s, uint32_t n)
union re2c::SwitchIf::@2 info
bool matches(const Span *b1, uint32_t n1, const State *s1, const Span *b2, uint32_t n2, const State *s2)
enum re2c::If::type_t type
std::vector< std::pair< uint32_t, uint32_t > > ranges
Binary(const Span *s, uint32_t n, const State *next)