forked from freeorion/freeorion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEffectParser.h
69 lines (55 loc) · 2.33 KB
/
EffectParser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef _EffectParser_h_
#define _EffectParser_h_
#include "ConditionParser.h"
#include "MovableEnvelope.h"
#include <boost/spirit/include/qi.hpp>
namespace Effect {
class Effect;
class EffectsGroup;
}
namespace parse { namespace detail {
using effect_payload = MovableEnvelope<Effect::Effect>;
using effect_signature = effect_payload ();
using effect_parser_rule = rule<effect_signature>;
using effect_parser_grammar = grammar<effect_signature>;
} //end namespace detail
} //end namespace parse
namespace parse {
struct effects_parser_grammar : public detail::effect_parser_grammar {
effects_parser_grammar(const lexer& tok,
detail::Labeller& label,
const detail::condition_parser_grammar& condition_parser,
const detail::value_ref_grammar<std::string>& string_grammar);
~effects_parser_grammar();
detail::effect_parser_rule start;
private:
struct Impl;
std::unique_ptr<Impl> m_impl;
};
using effects_group_payload = std::vector<parse::detail::MovableEnvelope<Effect::EffectsGroup>>;
using effects_group_signature = effects_group_payload ();
using effects_group_rule = detail::rule<effects_group_signature>;
struct effects_group_grammar : public detail::grammar<effects_group_signature> {
effects_group_grammar(const lexer& tok,
detail::Labeller& label,
const detail::condition_parser_grammar& condition_parser,
const detail::value_ref_grammar<std::string>& string_grammar);
typedef detail::rule<
parse::detail::MovableEnvelope<Effect::EffectsGroup> (),
boost::spirit::qi::locals<
parse::detail::condition_payload,
parse::detail::condition_payload,
std::string,
std::string,
int,
std::string
>
> effect_group_rule;
effects_parser_grammar effects_grammar;
detail::single_or_bracketed_repeat<effects_parser_grammar> one_or_more_effects;
effect_group_rule effects_group;
detail::single_or_bracketed_repeat<effect_group_rule> one_or_more_groups;
effects_group_rule start;
};
}
#endif