, value (val)
{}
-Binary::Binary (const Span * s, uint n, const State * from, const State * next)
+Binary::Binary (const Span * s, uint n, const State * next)
: cond (new Cond ("<=", s[n / 2 - 1].ub - 1))
- , thn (new If (n / 2 > 4 ? If::BINARY : If::LINEAR, &s[0], n / 2, from, next))
- , els (new If (n - n / 2 > 4 ? If::BINARY : If::LINEAR, &s[n / 2], n - n / 2, from, next))
+ , thn (new If (n / 2 > 4 ? If::BINARY : If::LINEAR, &s[0], n / 2, next))
+ , els (new If (n - n / 2 > 4 ? If::BINARY : If::LINEAR, &s[n / 2], n - n / 2, next))
{}
void Binary::emit (OutputFile & o, uint ind, bool & readCh)
o << indent (ind) << "}\n";
}
-Linear::Linear (const Span * s, uint n, const State * from, const State * next)
+Linear::Linear (const Span * s, uint n, const State * next)
: branches ()
{
for (;;)
}
if (n == 1)
{
- if (s[0].to->label != from->label + 1)
-// if (s[0].to->next && s[0].to->label != s[0].to->next->label + 1)
+ if (next == NULL || s[0].to->label != next->label)
{
branches.push_back (std::make_pair (static_cast<const Cond *> (NULL), s[0].to));
}
}
}
-If::If (type_t t, const Span * sp, uint nsp, const State * from, const State * next)
+If::If (type_t t, const Span * sp, uint nsp, const State * next)
: type (t)
, info ()
{
switch (type)
{
case BINARY:
- info.binary = new Binary (sp, nsp, from, next);
+ info.binary = new Binary (sp, nsp, next);
break;
case LINEAR:
- info.linear = new Linear (sp, nsp, from, next);
+ info.linear = new Linear (sp, nsp, next);
break;
}
}
}
}
-SwitchIf::SwitchIf (const Span * sp, uint nsp, const State * from, const State * next)
+SwitchIf::SwitchIf (const Span * sp, uint nsp, const State * next)
: type (IF)
, info ()
{
}
else if (nsp > 5)
{
- info.ifs = new If (If::BINARY, sp, nsp, from, next);
+ info.ifs = new If (If::BINARY, sp, nsp, next);
}
else
{
- info.ifs = new If (If::LINEAR, sp, nsp, from, next);
+ info.ifs = new If (If::LINEAR, sp, nsp, next);
}
}
}
}
-Bitmap::Bitmap (const Span * span, uint nSpans, const Span * hspan, uint hSpans, const BitMap * bm, const State * bm_state, const State * from, const State * next)
+Bitmap::Bitmap (const Span * span, uint nSpans, const Span * hspan, uint hSpans, const BitMap * bm, const State * bm_state, const State * next)
: bitmap (bm)
, bitmap_state (bm_state)
- , hgo (hSpans == 0 ? NULL : new SwitchIf (hspan, hSpans, from, next))
+ , hgo (hSpans == 0 ? NULL : new SwitchIf (hspan, hSpans, next))
, lgo (NULL)
{
Span * bspan = new Span [nSpans];
uint bSpans = unmap (bspan, span, nSpans, bm_state);
lgo = bSpans == 0
? NULL
- : new SwitchIf (bspan, bSpans, from, next);
+ : new SwitchIf (bspan, bSpans, next);
delete bspan;
}
o << indent (--ind) << "};\n";
}
-Cpgoto::Cpgoto (const Span * span, uint nSpans, const Span * hspan, uint hSpans, const State * from, const State * next)
- : hgo (hSpans == 0 ? NULL : new SwitchIf (hspan, hSpans, from, next))
+Cpgoto::Cpgoto (const Span * span, uint nSpans, const Span * hspan, uint hSpans, const State * next)
+ : hgo (hSpans == 0 ? NULL : new SwitchIf (hspan, hSpans, next))
, table (new CpgotoTable (span, nSpans))
{}
, info ()
{}
-void Go::init (const State * from, const State * next)
+void Go::init (const State * from)
{
if (nSpans == 0)
{
else if (gFlag && (dSpans >= cGotoThreshold))
{
type = CPGOTO;
- info.cpgoto = new Cpgoto (span, nSpans, hspan, hSpans, from, next);
+ info.cpgoto = new Cpgoto (span, nSpans, hspan, hSpans, from->next);
}
else if (bFlag && (nBitmaps > 0))
{
type = BITMAP;
- info.bitmap = new Bitmap (span, nSpans, hspan, hSpans, bitmap, bitmap_state, from, next);
+ info.bitmap = new Bitmap (span, nSpans, hspan, hSpans, bitmap, bitmap_state, from->next);
bUsedYYBitmap = true;
}
else
{
type = SWITCH_IF;
- info.switchif = new SwitchIf (span, nSpans, from, next);
+ info.switchif = new SwitchIf (span, nSpans, from->next);
}
}
Cond * cond;
If * thn;
If * els;
- Binary (const Span * s, uint n, const State * from, const State * next);
+ Binary (const Span * s, uint n, const State * next);
void emit (OutputFile & o, uint ind, bool & readCh);
};
struct Linear
{
std::vector<std::pair<const Cond *, const State *> > branches;
- Linear (const Span * s, uint n, const State * from, const State * next);
+ Linear (const Span * s, uint n, const State * next);
void emit (OutputFile & o, uint ind, bool & readCh);
};
Binary * binary;
Linear * linear;
} info;
- If (type_t t, const Span * sp, uint nsp, const State * from, const State * next);
+ If (type_t t, const Span * sp, uint nsp, const State * next);
void emit (OutputFile & o, uint ind, bool & readCh);
};
Cases * cases;
If * ifs;
} info;
- SwitchIf (const Span * sp, uint nsp, const State * from, const State * next);
+ SwitchIf (const Span * sp, uint nsp, const State * next);
void emit (OutputFile & o, uint ind, bool & readCh);
};
const State * bitmap_state;
SwitchIf * hgo;
SwitchIf * lgo;
- Bitmap (const Span * span, uint nSpans, const Span * hspan, uint hSpans, const BitMap * bm, const State * bm_state, const State * from, const State * next);
+ Bitmap (const Span * span, uint nSpans, const Span * hspan, uint hSpans, const BitMap * bm, const State * bm_state, const State * next);
void emit (OutputFile & o, uint ind, bool & readCh);
};
{
SwitchIf * hgo;
CpgotoTable * table;
- Cpgoto (const Span * span, uint nSpans, const Span * hspan, uint hSpans, const State * from, const State * next);
+ Cpgoto (const Span * span, uint nSpans, const Span * hspan, uint hSpans, const State * next);
void emit (OutputFile & o, uint ind, bool & readCh);
};
} info;
Go ();
- void init (const State * from, const State * next);
+ void init (const State * from);
void emit (OutputFile & o, uint ind, bool & readCh);
};