src
Main Page
Namespaces
Classes
Files
File List
File Members
ir
skeleton
maxlen.cc
Go to the documentation of this file.
1
#include "
src/util/c99_stdint.h
"
2
#include <algorithm>
3
#include <limits>
4
#include <map>
5
#include <utility>
6
7
#include "
src/ir/skeleton/skeleton.h
"
8
9
namespace
re2c
10
{
11
12
// 0 < DIST_MAX < DIST_ERROR <= std::numeric_limits<uint32_t>::max()
13
const
uint32_t
Node::DIST_ERROR
= std::numeric_limits<uint32_t>::max();
14
const
uint32_t
Node::DIST_MAX
= DIST_ERROR - 1;
15
16
// different from YYMAXFILL calculation
17
// in the way it handles loops and empty regexp
18
void
Node::calc_dist
()
19
{
20
if
(
dist
!=
DIST_ERROR
)
21
{
22
return
;
23
}
24
else
if
(
end
())
25
{
26
dist
= 0;
27
}
28
else
if
(
loop
< 2)
29
{
30
local_inc
_ (
loop
);
31
for
(arcs_t::iterator i =
arcs
.begin (); i !=
arcs
.end (); ++i)
32
{
33
i->first->calc_dist ();
34
if
(i->first->dist !=
DIST_ERROR
)
35
{
36
if
(
dist
==
DIST_ERROR
)
37
{
38
dist
= i->first->dist;
39
}
40
else
41
{
42
dist
= std::max (
dist
, i->first->dist);
43
}
44
}
45
}
46
dist
= std::min (
dist
+ 1,
DIST_MAX
);
47
}
48
}
49
50
}
// namespace re2c
skeleton.h
re2c::Node::calc_dist
void calc_dist()
Definition:
maxlen.cc:18
re2c::local_increment_t
Definition:
local_increment.h:8
re2c::Node::dist
uint32_t dist
Definition:
skeleton.h:86
re2c::Node::arcs
arcs_t arcs
Definition:
skeleton.h:70
re2c::Node::loop
uint8_t loop
Definition:
skeleton.h:75
re2c::Node::DIST_ERROR
static const uint32_t DIST_ERROR
Definition:
skeleton.h:84
re2c::Node::end
bool end() const
Definition:
skeleton.cc:67
c99_stdint.h
re2c::Node::DIST_MAX
static const uint32_t DIST_MAX
Definition:
skeleton.h:85
re2c
Definition:
bitmap.cc:10
Generated by
1.8.10