src
rule_rank.cc
Go to the documentation of this file.
1 #include <assert.h>
2 #include <limits>
3 #include <ostream>
4 
5 #include "src/ir/rule_rank.h"
6 
7 namespace re2c
8 {
9 
10 const uint32_t rule_rank_t::NONE = std::numeric_limits<uint32_t>::max();
11 const uint32_t rule_rank_t::DEF = rule_rank_t::NONE - 1;
12 
13 rule_rank_t::rule_rank_t ()
14  : value (0)
15 {}
16 
17 void rule_rank_t::inc ()
18 {
19  assert (value < DEF - 1);
20  ++value;
21 }
22 
24 {
25  rule_rank_t r;
26  r.value = NONE;
27  return r;
28 }
29 
31 {
32  rule_rank_t r;
33  r.value = DEF;
34  return r;
35 }
36 
37 bool rule_rank_t::is_none () const
38 {
39  return value == NONE;
40 }
41 
42 bool rule_rank_t::is_def () const
43 {
44  return value == DEF;
45 }
46 
48 {
49  return value < r.value;
50 }
51 
53 {
54  return value == r.value;
55 }
56 
57 std::ostream & operator << (std::ostream & o, rule_rank_t r)
58 {
59  o << r.value;
60  return o;
61 }
62 
63 uint32_t rule_rank_t::uint32 () const
64 {
65  return value;
66 }
67 
68 } // namespace re2c
bool is_def() const
Definition: rule_rank.cc:42
std::ostream & operator<<(std::ostream &o, label_t l)
Definition: label.cc:36
uint32_t uint32() const
Definition: rule_rank.cc:63
bool is_none() const
Definition: rule_rank.cc:37
static rule_rank_t none()
Definition: rule_rank.cc:23
bool operator==(const rule_rank_t &r) const
Definition: rule_rank.cc:52
static rule_rank_t def()
Definition: rule_rank.cc:30
Definition: bitmap.cc:10
bool operator<(const rule_rank_t &r) const
Definition: rule_rank.cc:47