src
range_suffix.cc
Go to the documentation of this file.
2 #include "src/ir/regexp/regexp.h"
4 #include "src/util/range.h"
5 
6 namespace re2c {
7 
8 static RegExp * emit (RangeSuffix * p, RegExp * re);
9 
10 free_list<RangeSuffix *> RangeSuffix::freeList;
11 
13 {
14  return p
15  ? emit (p, NULL)
16  : new MatchOp (NULL);
17 }
18 
19 /*
20  * Build regexp from suffix tree.
21  */
23 {
24  if (p == NULL)
25  return re;
26  else
27  {
28  RegExp * regexp = NULL;
29  for (; p != NULL; p = p->next)
30  {
31  RegExp * re1 = doCat(new MatchOp(Range::ran (p->l, p->h + 1)), re);
32  regexp = doAlt(regexp, emit(p->child, re1));
33  }
34  return regexp;
35  }
36 }
37 
38 } // namespace re2c
static Range * ran(uint32_t l, uint32_t u)
Definition: range.h:31
RegExp * doAlt(RegExp *e1, RegExp *e2)
Definition: regexp.cc:27
RangeSuffix * child
Definition: range_suffix.h:21
RangeSuffix * next
Definition: range_suffix.h:20
RegExp * to_regexp(RangeSuffix *p)
Definition: range_suffix.cc:12
static free_list< RangeSuffix * > freeList
Definition: range_suffix.h:16
static RegExp * emit(RangeSuffix *p, RegExp *re)
Definition: range_suffix.cc:22
Definition: bitmap.cc:10
RegExp * doCat(RegExp *e1, RegExp *e2)
Definition: regexp.cc:98