src
Main Page
Namespaces
Classes
Files
File List
File Members
parse
spec.h
Go to the documentation of this file.
1
#ifndef _RE2C_PARSE_SPEC_
2
#define _RE2C_PARSE_SPEC_
3
4
#include "
src/ir/regexp/regexp_rule.h
"
5
#include "
src/parse/rules.h
"
6
7
namespace
re2c
8
{
9
10
struct
Spec
11
{
12
RegExp
*
re
;
13
rules_t
rules
;
14
15
Spec
()
16
: re (NULL)
17
, rules ()
18
{}
19
Spec
(
const
Spec
& spec)
20
: re (spec.re)
21
, rules (spec.rules)
22
{}
23
Spec
&
operator =
(
const
Spec
& spec)
24
{
25
re = spec.
re
;
26
rules = spec.
rules
;
27
return
*
this
;
28
}
29
bool
add_def
(
RuleOp
* r)
30
{
31
if
(rules.find (
rule_rank_t::def
()) != rules.end ())
32
{
33
return
false
;
34
}
35
else
36
{
37
add
(r);
38
return
true
;
39
}
40
}
41
void
add
(
RuleOp
* r)
42
{
43
rules[r->
rank
].line = r->
loc
.
line
;
44
re =
mkAlt
(re, r);
45
}
46
void
clear
()
47
{
48
re = NULL;
49
rules.clear ();
50
}
51
};
52
53
}
// namespace re2c
54
55
#endif // _RE2C_PARSE_SPEC_
re2c::Loc::line
uint32_t line
Definition:
loc.h:14
re2c::RuleOp
Definition:
regexp_rule.h:13
re2c::Spec::Spec
Spec()
Definition:
spec.h:15
re2c::Spec::add
void add(RuleOp *r)
Definition:
spec.h:41
re2c::rules_t
std::map< rule_rank_t, rule_info_t > rules_t
Definition:
rules.h:25
re2c::RegExp
Definition:
regexp.h:20
re2c::Spec::Spec
Spec(const Spec &spec)
Definition:
spec.h:19
re2c::Spec::operator=
Spec & operator=(const Spec &spec)
Definition:
spec.h:23
re2c::Spec::rules
rules_t rules
Definition:
spec.h:13
re2c::Spec::clear
void clear()
Definition:
spec.h:46
regexp_rule.h
rules.h
re2c::Spec
Definition:
spec.h:10
re2c::RuleOp::rank
rule_rank_t rank
Definition:
regexp_rule.h:23
re2c::Spec::add_def
bool add_def(RuleOp *r)
Definition:
spec.h:29
re2c::RuleOp::loc
const Loc loc
Definition:
regexp_rule.h:16
re2c::Spec::re
RegExp * re
Definition:
spec.h:12
re2c::rule_rank_t::def
static rule_rank_t def()
Definition:
rule_rank.cc:30
re2c
Definition:
bitmap.cc:10
re2c::mkAlt
RegExp * mkAlt(RegExp *e1, RegExp *e2)
Definition:
regexp.cc:40
Generated by
1.8.10