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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
#include "ValueRefParser.h"
#include "MovableEnvelope.h"
#include "../universe/ValueRefs.h"
#include <boost/phoenix.hpp>
namespace parse { namespace detail {
string_complex_parser_grammar::string_complex_parser_grammar(
const parse::lexer& tok,
Labeller& label,
const value_ref_grammar<std::string>& string_grammar
) :
string_complex_parser_grammar::base_type(start, "string_complex_parser_grammar"),
simple_int_rules(tok)
{
namespace phoenix = boost::phoenix;
namespace qi = boost::spirit::qi;
using phoenix::construct;
using phoenix::new_;
qi::_1_type _1;
qi::_2_type _2;
qi::_3_type _3;
qi::_val_type _val;
qi::_pass_type _pass;
const boost::phoenix::function<detail::construct_movable> construct_movable_;
const boost::phoenix::function<detail::deconstruct_movable> deconstruct_movable_;
const value_ref_rule<int>& simple_int = simple_int_rules.simple;
game_rule
= ( tok.GameRule_
> label(tok.name_) > string_grammar
) [ _val = construct_movable_(new_<ValueRef::ComplexVariable<std::string>>(_1, nullptr, nullptr, nullptr, deconstruct_movable_(_2, _pass), nullptr)) ]
;
empire_ref =
(
( tok.LowestCostEnqueuedTech_
| tok.HighestCostEnqueuedTech_
| tok.TopPriorityEnqueuedTech_
| tok.MostSpentEnqueuedTech_
| tok.RandomEnqueuedTech_
| tok.LowestCostResearchableTech_
| tok.HighestCostResearchableTech_
| tok.TopPriorityResearchableTech_
| tok.MostSpentResearchableTech_
| tok.RandomResearchableTech_
| tok.RandomCompleteTech_
| tok.MostPopulousSpecies_
| tok.MostHappySpecies_
| tok.LeastHappySpecies_
| tok.RandomColonizableSpecies_
| tok.RandomControlledSpecies_
)
> label(tok.empire_) > simple_int
) [ _val = construct_movable_(new_<ValueRef::ComplexVariable<std::string>>(_1, deconstruct_movable_(_2, _pass), nullptr, nullptr, nullptr, nullptr)) ]
;
empire_empire_ref =
(
( tok.LowestCostTransferrableTech_
| tok.HighestCostTransferrableTech_
| tok.TopPriorityTransferrableTech_
| tok.MostSpentTransferrableTech_
| tok.RandomTransferrableTech_
)
> label(tok.empire_) > simple_int
> label(tok.empire_) > simple_int
) [ _val = construct_movable_(new_<ValueRef::ComplexVariable<std::string>>(_1, deconstruct_movable_(_2, _pass), deconstruct_movable_(_3, _pass), nullptr, nullptr, nullptr)) ]
;
start
%= game_rule
| empire_ref
| empire_empire_ref
;
game_rule.name("GameRule");
empire_ref.name("LowestCostEnqueuedTech, HighestCostEnqueuedTech, TopPriorityEnqueuedTech, "
"MostSpentEnqueuedTech, RandomEnqueuedTech, LowestCostResearchableTech, "
"HighestCostesearchableTech, TopPriorityResearchableTech, MostSpentResearchableTech, "
"RandomResearchableTech, MostPopulousSpecies, MostHappySpecies, "
"LeastHappySpecies, RandomColonizableSpecies, RandomControlledSpecies");
empire_empire_ref.name("LowestCostTransferrableTech, HighestCostTransferrableTech, "
"TopPriorityTransferrableTech, MostSpentTransferrableTech, "
"RandomTransferrableTech");
#if DEBUG_DOUBLE_COMPLEX_PARSERS
debug(game_rule);
debug(empire_ref);
debug(empire_empire_ref);
#endif
}
}}
|