src
calc_size.cc
Go to the documentation of this file.
1 #include "src/util/c99_stdint.h"
2 
3 #include "src/ir/regexp/regexp.h"
10 
11 namespace re2c
12 {
13 
14 uint32_t AltOp::calc_size() const
15 {
16  return exp1->calc_size()
17  + exp2->calc_size()
18  + 1;
19 }
20 
21 uint32_t CatOp::calc_size() const
22 {
23  return exp1->calc_size()
24  + exp2->calc_size();
25 }
26 
27 uint32_t CloseOp::calc_size() const
28 {
29  return exp->calc_size() + 1;
30 }
31 
32 uint32_t MatchOp::calc_size() const
33 {
34  return 1;
35 }
36 
37 uint32_t NullOp::calc_size() const
38 {
39  return 0;
40 }
41 
42 uint32_t RuleOp::calc_size() const
43 {
44  const uint32_t n = ctx->calc_size();
45  return exp->calc_size()
46  + (n > 0 ? n + 1 : 0)
47  + 1;
48 }
49 
50 } // end namespace re2c
uint32_t calc_size() const
Definition: calc_size.cc:27
uint32_t calc_size() const
Definition: calc_size.cc:21
uint32_t calc_size() const
Definition: calc_size.cc:14
uint32_t calc_size() const
Definition: calc_size.cc:32
uint32_t calc_size() const
Definition: calc_size.cc:42
RegExp * ctx
Definition: regexp_rule.h:22
uint32_t calc_size() const
Definition: calc_size.cc:37
virtual uint32_t calc_size() const =0
Definition: bitmap.cc:10