src
Main Page
Namespaces
Classes
Files
File List
File Members
ir
adfa
adfa.h
Go to the documentation of this file.
1
#ifndef _RE2C_IR_ADFA_ADFA_
2
#define _RE2C_IR_ADFA_ADFA_
3
4
#include <stddef.h>
5
#include "
src/util/c99_stdint.h
"
6
#include <set>
7
#include <string>
8
9
#include "
src/codegen/go.h
"
10
#include "
src/codegen/label.h
"
11
#include "
src/ir/adfa/action.h
"
12
#include "
src/ir/regexp/regexp.h
"
13
#include "
src/util/forbid_copy.h
"
14
15
namespace
re2c
16
{
17
18
struct
Skeleton;
19
struct
Output;
20
struct
OutputFile;
21
struct
dfa_t;
22
23
struct
State
24
{
25
label_t
label
;
26
RuleOp
*
rule
;
27
State
*
next
;
28
size_t
fill
;
29
30
bool
isPreCtxt
;
31
bool
isBase
;
32
Go
go
;
33
Action
action
;
34
35
State
()
36
: label (
label_t
::first ())
37
, rule (NULL)
38
, next (0)
39
, fill (0)
40
, isPreCtxt (false)
41
, isBase (false)
42
, go ()
43
, action ()
44
{}
45
~State
()
46
{
47
operator
delete
(go.
span
);
48
}
49
50
FORBID_COPY
(
State
);
51
};
52
53
class
DFA
54
{
55
accept_t
accepts;
56
Skeleton
* skeleton;
57
58
public
:
59
const
std::string
name
;
60
const
std::string
cond
;
61
const
uint32_t
line
;
62
63
uint32_t
lbChar
;
64
uint32_t
ubChar
;
65
uint32_t
nStates
;
66
State
*
head
;
67
68
// statistics
69
size_t
max_fill
;
70
bool
need_backup
;
71
bool
need_backupctx
;
72
bool
need_accept
;
73
74
public
:
75
DFA
(
const
dfa_t
&dfa
76
,
const
std::vector<size_t> &fill
77
,
Skeleton
*skel
78
,
const
charset_t
&charset
79
,
const
std::string &n
80
,
const
std::string &c
81
, uint32_t l
82
);
83
~DFA
();
84
void
reorder
();
85
void
prepare
();
86
void
calc_stats
();
87
void
emit
(
Output
&, uint32_t &,
bool
,
bool
&);
88
89
private
:
90
void
addState(
State
*,
State
*);
91
void
split (
State
*);
92
void
findBaseState ();
93
void
count_used_labels (std::set<label_t> & used,
label_t
prolog,
label_t
start,
bool
force_start)
const
;
94
void
emit_body (
OutputFile
&, uint32_t &,
const
std::set<label_t> & used_labels,
label_t
initial)
const
;
95
96
FORBID_COPY (
DFA
);
97
};
98
99
}
// namespace re2c
100
101
#endif // _RE2C_IR_ADFA_ADFA_
re2c::DFA::line
const uint32_t line
Definition:
adfa.h:61
re2c::RuleOp
Definition:
regexp_rule.h:13
re2c::OutputFile
Definition:
output.h:55
re2c::DFA::max_fill
size_t max_fill
Definition:
adfa.h:69
re2c::charset_t
std::vector< uint32_t > charset_t
Definition:
regexp.h:16
go.h
re2c::DFA::calc_stats
void calc_stats()
Definition:
prepare.cc:240
re2c::State::isPreCtxt
bool isPreCtxt
Definition:
adfa.h:30
re2c::State::State
State()
Definition:
adfa.h:35
re2c::DFA::cond
const std::string cond
Definition:
adfa.h:60
re2c::State::fill
size_t fill
Definition:
adfa.h:28
re2c::label_t
Definition:
label.h:21
re2c::State::rule
RuleOp * rule
Definition:
adfa.h:26
re2c::DFA::lbChar
uint32_t lbChar
Definition:
adfa.h:63
re2c::DFA::~DFA
~DFA()
Definition:
adfa.cc:79
action.h
re2c::State::FORBID_COPY
FORBID_COPY(State)
re2c::DFA::emit
void emit(Output &, uint32_t &, bool, bool &)
Definition:
emit_dfa.cc:115
re2c::State::action
Action action
Definition:
adfa.h:33
re2c::Output
Definition:
output.h:134
re2c::DFA::DFA
DFA(const dfa_t &dfa, const std::vector< size_t > &fill, Skeleton *skel, const charset_t &charset, const std::string &n, const std::string &c, uint32_t l)
Definition:
adfa.cc:17
re2c::DFA::need_backup
bool need_backup
Definition:
adfa.h:70
forbid_copy.h
re2c::DFA::need_backupctx
bool need_backupctx
Definition:
adfa.h:71
re2c::DFA::ubChar
uint32_t ubChar
Definition:
adfa.h:64
re2c::Action
Definition:
action.h:30
re2c::State::label
label_t label
Definition:
adfa.h:25
re2c::DFA::head
State * head
Definition:
adfa.h:66
re2c::dfa_t
Definition:
dfa.h:36
re2c::DFA::reorder
void reorder()
Definition:
adfa.cc:92
re2c::State::isBase
bool isBase
Definition:
adfa.h:31
re2c::uniq_vector_t< const State * >
regexp.h
c99_stdint.h
re2c::DFA::prepare
void prepare()
Definition:
prepare.cc:140
re2c::DFA
Definition:
adfa.h:53
re2c::State::~State
~State()
Definition:
adfa.h:45
re2c::State::go
Go go
Definition:
adfa.h:32
label.h
re2c::Skeleton
Definition:
skeleton.h:107
re2c::Go::span
Span * span
Definition:
go.h:175
re2c::DFA::nStates
uint32_t nStates
Definition:
adfa.h:65
re2c
Definition:
bitmap.cc:10
re2c::State
Definition:
adfa.h:23
re2c::DFA::need_accept
bool need_accept
Definition:
adfa.h:72
re2c::Go
Definition:
go.h:172
re2c::DFA::name
const std::string name
Definition:
adfa.h:59
re2c::State::next
State * next
Definition:
adfa.h:27
Generated by
1.8.10