void emit_accept (OutputFile & o, uint32_t ind, bool & readCh, const State * const s, const accept_t & accepts)
{
- const uint32_t accepts_size = accepts.size ();
+ const uint32_t accepts_size = static_cast<uint32_t> (accepts.size ());
if (accepts_size > 0)
{
if (!DFlag)
{
if (!s->go.span[i].to->rule && s->go.span[i].to->action.type != Action::RULE)
{
- const uint32_t accept = accepts.find_or_add (rules[s->rule->rank]);
+ const uint32_t accept = static_cast<uint32_t> (accepts.find_or_add (rules[s->rule->rank]));
s->action.set_save (accept);
}
}
#include <vector>
-#include "src/util/c99_stdint.h"
-
namespace re2c
{
// wrapper over std::vector
// O(n) lookup
-// O(n^2) insertion
+// O(n) insertion
template <typename value_t>
class uniq_vector_t
{
uniq_vector_t ()
: elems ()
{}
- uint32_t size () const
+ size_t size () const
{
return elems.size ();
}
- const value_t & operator [] (uint32_t i) const
+ const value_t & operator [] (size_t i) const
{
return elems[i];
}
- uint32_t find_or_add (const value_t & v)
+ size_t find_or_add (const value_t & v)
{
- const uint32_t size = elems.size ();
- for (uint32_t i = 0; i < size; ++i)
+ const size_t size = elems.size ();
+ for (size_t i = 0; i < size; ++i)
{
if (elems[i] == v)
{