{
template <typename cunit_t, typename key_t>
- static Node::covers_t cover_one (FILE * input, FILE * keys, const multipath_t & path);
+ static Node::covers_t cover_one (FILE * input, FILE * keys, const path_t & path);
/*
* note [generating skeleton path cover]
*
*/
template <typename cunit_t, typename key_t>
- Node::covers_t Node::cover (multipath_t & prefix, FILE * input, FILE * keys)
+ Node::covers_t Node::cover (path_t & prefix, FILE * input, FILE * keys)
{
covers_t size = covers_t::from32(0u);
if (end () && suffix == NULL)
{
- suffix = new multipath_t (rule, ctx);
+ suffix = new path_t (rule, ctx);
}
if (suffix != NULL)
{
local_inc _ (loop);
for (arcs_t::iterator i = arcs.begin (); i != arcs.end (); ++i)
{
- multipath_t new_prefix = prefix;
+ path_t new_prefix = prefix;
new_prefix.extend (i->first->rule, i->first->ctx, &i->second);
size = size + i->first->cover<cunit_t, key_t> (new_prefix, input, keys);
if (size.overflow ())
}
if (i->first->suffix != NULL && suffix == NULL)
{
- suffix = new multipath_t (rule, ctx);
+ suffix = new path_t (rule, ctx);
suffix->extend (i->first->rule, i->first->ctx, &i->second);
suffix->append (i->first->suffix);
}
template <typename cunit_t, typename key_t>
void Skeleton::generate_paths_cunit_key (FILE * input, FILE * keys)
{
- multipath_t prefix (nodes->rule, nodes->ctx);
+ path_t prefix (nodes->rule, nodes->ctx);
if (nodes->cover<cunit_t, key_t> (prefix, input, keys).overflow ())
{
warning
}
template <typename cunit_t, typename key_t>
- static Node::covers_t cover_one (FILE * input, FILE * keys, const multipath_t & path)
+ static Node::covers_t cover_one (FILE * input, FILE * keys, const path_t & path)
{
const size_t len = path.len ();
}
};
-template <typename arc_t>
-class generic_path_t
+class path_t
{
- std::vector<arc_t> arcs;
+public:
+ typedef std::vector<uint32_t> arc_t;
+
+private:
+ std::vector<const arc_t *> arcs;
rule_t rule;
size_t rule_pos;
size_t ctx_pos;
public:
- explicit generic_path_t (rule_t r, bool c)
+ explicit path_t (rule_t r, bool c)
: arcs ()
, rule (r)
, rule_pos (0)
{
return rule.rank;
}
- const arc_t & operator [] (size_t i) const
+ const arc_t * operator [] (size_t i) const
{
return arcs[i];
}
- void extend (rule_t r, bool c, const arc_t & a)
+ void extend (rule_t r, bool c, const arc_t * a)
{
arcs.push_back (a);
if (!r.rank.is_none ())
ctx_pos = arcs.size ();
}
}
- void append (const generic_path_t<arc_t> * p)
+ void append (const path_t * p)
{
if (!p->rule.rank.is_none ())
{
}
};
-typedef generic_path_t<uint32_t> path_t;
-
-typedef std::vector<uint32_t> multiarc_t;
-typedef generic_path_t<const multiarc_t *> multipath_t;
-
} // namespace re2c
#endif // _RE2C_CODEGEN_SKELETON_PATH_
typedef u32lim_t<1024 * 1024 * 64> nakeds_t; // ~64Mb
typedef std::map<const State *, Node *> s2n_map;
- typedef std::map<Node *, multiarc_t> arcs_t;
+ typedef std::map<Node *, path_t::arc_t> arcs_t;
typedef std::map<Node *, way_arc_t> arcsets_t;
typedef local_increment_t<uint8_t> local_inc;
std::set<rule_t> reachable;
// path to end node (for constructing path cover)
- multipath_t * suffix;
+ path_t * suffix;
Node ();
void init (const State * s, const s2n_map & s2n);
void calc_dist ();
void calc_reachable ();
template <typename cunit_t, typename key_t>
- covers_t cover (multipath_t & prefix, FILE * input, FILE * keys);
+ covers_t cover (path_t & prefix, FILE * input, FILE * keys);
nakeds_t naked_ways (const way_t & prefix, std::vector<way_t> & ways);
FORBID_COPY (Node);