src
nfa.h
Go to the documentation of this file.
1 #ifndef _RE2C_IR_NFA_NFA_
2 #define _RE2C_IR_NFA_NFA_
3 
4 #include "src/util/c99_stdint.h"
5 
6 #include "src/util/forbid_copy.h"
7 
8 namespace re2c
9 {
10 
11 struct Range;
12 struct RegExp;
13 struct RuleOp;
14 
16 {
17  enum type_t
18  {
19  ALT,
20  RAN,
21  CTX,
23  } type;
24  union
25  {
26  struct
27  {
30  } alt;
31  struct
32  {
35  } ran;
36  struct
37  {
39  } ctx;
40  struct
41  {
43  } fin;
44  } value;
45  bool mark;
46 
47  void alt(nfa_state_t *s1, nfa_state_t *s2)
48  {
49  type = ALT;
50  value.alt.out1 = s1;
51  value.alt.out2 = s2;
52  mark = false;
53  }
54  void ran(nfa_state_t *s, Range *r)
55  {
56  type = RAN;
57  value.ran.out = s;
58  value.ran.ran = r;
59  mark = false;
60  }
61  void ctx(nfa_state_t *s)
62  {
63  type = CTX;
64  value.ctx.out = s;
65  mark = false;
66  }
67  void fin(RuleOp *r)
68  {
69  type = FIN;
70  value.fin.rule = r;
71  mark = false;
72  }
73 };
74 
75 struct nfa_t
76 {
77  const uint32_t max_size;
78  uint32_t size;
81 
82  nfa_t(RegExp *re);
83  ~nfa_t();
84 
86 };
87 
88 } // namespace re2c
89 
90 #endif // _RE2C_IR_NFA_NFA_
nfa_t(RegExp *re)
Definition: nfa.cc:12
void alt(nfa_state_t *s1, nfa_state_t *s2)
Definition: nfa.h:47
nfa_state_t * out
Definition: nfa.h:33
union re2c::nfa_state_t::@6 value
const uint32_t max_size
Definition: nfa.h:77
void fin(RuleOp *r)
Definition: nfa.h:67
bool mark
Definition: nfa.h:45
uint32_t size
Definition: nfa.h:78
enum re2c::nfa_state_t::type_t type
nfa_state_t * out2
Definition: nfa.h:29
FORBID_COPY(nfa_t)
nfa_state_t * out1
Definition: nfa.h:28
struct re2c::nfa_state_t::@6::@10 fin
struct re2c::nfa_state_t::@6::@7 alt
void ran(nfa_state_t *s, Range *r)
Definition: nfa.h:54
nfa_state_t * root
Definition: nfa.h:80
struct re2c::nfa_state_t::@6::@9 ctx
~nfa_t()
Definition: nfa.cc:19
Range * ran
Definition: nfa.h:34
RuleOp * rule
Definition: nfa.h:42
Definition: bitmap.cc:10
nfa_state_t * states
Definition: nfa.h:79
void ctx(nfa_state_t *s)
Definition: nfa.h:61