}
/*
-void generate_data (DataFile & o, uint ind, SkeletonState * s, const std::vector<Prefix> & xs, std::vector<Result> & ys)
+void generate_data (DataFile & o, uint ind, SkeletonState * s, const std::vector<Path> & xs, std::vector<Result> & ys)
{
if (is_final (s) || is_default (s))
{
s->visited = true;
for (SkeletonState::go_t::iterator i = s->go.begin (); i != s->go.end (); ++i)
{
- std::vector<Prefix> zs;
+ std::vector<Path> zs;
for (uint j = 0; j < xs.size (); ++j)
{
const bool is_accepting = s->rule != ~0u;
for (uint k = 0; k < i->second.size (); ++k)
{
z.push_back (i->second[k].first);
- zs.push_back (Prefix (z, l, r));
+ zs.push_back (Path (z, l, r));
if (i->second[k].first != i->second[k].second)
{
z.pop_back ();
z.push_back (i->second[k].second);
- zs.push_back (Prefix (z, l, r));
+ zs.push_back (Path (z, l, r));
}
z.pop_back ();
}
}
*/
-void update (Prefix & p, SkeletonState * s)
+void update (Path & p, SkeletonState * s)
{
if (s->rule != ~0u)
{
}
}
-void append (Prefix & p1, const Prefix & p2)
+void append (Path & p1, const Path & p2)
{
if (p2.rule != ~0u)
{
o.file << "\n";
}
-void generate (DataFile & o, uint ind, SkeletonState * s, std::vector<Prefix> & prefixes, std::vector<Result> & results)
+void generate (DataFile & o, uint ind, SkeletonState * s, std::vector<Path> & prefixes, std::vector<Result> & results)
{
if (s == NULL)
{
if (s->path != NULL)
{
- std::vector<Prefix> zs (prefixes);
+ std::vector<Path> zs (prefixes);
for (uint i = 0; i < zs.size (); ++i)
{
append (zs[i], * s->path);
uint k = 0;
for (SkeletonState::go_t::iterator i = s->go.begin (); i != s->go.end (); ++i)
{
- std::vector<Prefix> zs;
+ std::vector<Path> zs;
for (uint j = 0; j < i->second.size (); ++j)
{
zs.push_back (prefixes[k++]);
generate (o, ind, i->first, zs, results);
if (s->path == NULL && i->first->path != NULL)
{
- s->path = new Prefix (std::vector<uint> (1, i->second[0]), 0, s->rule);
+ s->path = new Path (std::vector<uint> (1, i->second[0]), 0, s->rule);
append (* s->path, * i->first->path);
}
}
{
if (states[i].is_end ())
{
- states[i].path = new Prefix (std::vector<uint> (), 0, states[i].rule);
+ states[i].path = new Path (std::vector<uint> (), 0, states[i].rule);
}
}
- std::vector<Prefix> prefixes;
- prefixes.push_back (Prefix (std::vector<uint> (), 0, ~0));
+ std::vector<Path> prefixes;
+ prefixes.push_back (Path (std::vector<uint> (), 0, ~0));
generate (o, ind, states, prefixes, results);
namespace re2c
{
-struct Prefix
+struct Path
{
std::vector<uint> chars;
uint length;
uint rule;
- inline Prefix (const std::vector<uint> & cs, uint l, uint r)
+ inline Path (const std::vector<uint> & cs, uint l, uint r)
: chars (cs)
, length (l)
, rule (r)
uint processed;
uint consumed;
uint rule;
- inline explicit Result (const Prefix & p)
+ inline explicit Result (const Path & p)
: processed (p.chars.size ())
, consumed (p.length)
, rule (p.rule)
go_t go;
uint rule;
uchar visited;
- Prefix * path;
+ Path * path;
inline SkeletonState ()
: go ()
, rule (~0u)
unsigned long count_data (SkeletonState * s, unsigned long count);
void skeleton_emit_prolog (OutputFile & o, uint ind, const char * data_name);
void skeleton_emit_epilog (OutputFile & o, uint ind);
-void update (Prefix & p, SkeletonState * s);
-void append (Prefix & p1, const Prefix * p2);
+void update (Path & p, SkeletonState * s);
+void append (Path & p1, const Path * p2);
void dump_paths (DataFile & o, uint ind, const std::vector<uint> & path);
-void generate (DataFile & o, uint ind, SkeletonState * s, std::vector<Prefix> & prefixes, std::vector<Result> & results);
+void generate (DataFile & o, uint ind, SkeletonState * s, std::vector<Path> & prefixes, std::vector<Result> & results);
} // namespace re2c