ExpressionContainer.hh
2.07 KB
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
#ifndef EXPRESSIONCONTAINER_HH_
#define EXPRESSIONCONTAINER_HH_
namespace AMDA {
namespace parser {
struct op_not {};
struct op_or {};
struct op_greater{};
struct op_greaterOrEqual{};
struct op_lowerOrEqual{};
struct op_lower{};
struct op_and {};
struct op_xor {};
struct op_equal {};
struct op_unequal {};
struct op_sum {};
struct op_difference {};
struct op_factor {};
struct op_division {};
struct op_power{};
struct op_powerTen{};
struct op_plusSign {};
struct op_minusSign {};
namespace Expression{
typedef std::string var;
template <typename tag> struct binop;
template <typename tag> struct unop;
template <typename tag> struct comop;
typedef boost::variant<var,
boost::recursive_wrapper<unop <op_not> >,
boost::recursive_wrapper<binop<op_equal> >,
boost::recursive_wrapper<comop<op_greater> >,
boost::recursive_wrapper<binop<op_greaterOrEqual> >,
boost::recursive_wrapper<binop<op_lowerOrEqual> >,
boost::recursive_wrapper<comop<op_lower> >,
boost::recursive_wrapper<binop<op_unequal> >,
boost::recursive_wrapper<binop<op_and> >,
boost::recursive_wrapper<binop<op_xor> >,
boost::recursive_wrapper<binop<op_or> >,
boost::recursive_wrapper<binop<op_difference> >,
boost::recursive_wrapper<binop<op_sum> >,
boost::recursive_wrapper<binop<op_factor> >,
boost::recursive_wrapper<binop<op_division> >,
boost::recursive_wrapper<binop<op_power> >,
boost::recursive_wrapper<binop<op_powerTen> >,
boost::recursive_wrapper<unop<op_minusSign> >,
boost::recursive_wrapper<unop<op_plusSign> >
> expressionContainer;
template <typename tag> struct binop
{
explicit binop(const expressionContainer& l, const expressionContainer& r) : oper1(l), oper2(r) { }
expressionContainer oper1, oper2;
};
template <typename tag> struct comop
{
explicit comop(const expressionContainer& l, const expressionContainer& r) : oper1(l), oper2(r) { }
expressionContainer oper1, oper2;
};
template <typename tag> struct unop
{
explicit unop(const expressionContainer& o) : oper1(o) { }
expressionContainer oper1;
};
} /* namespace Expression */
} /* namespace parser */
} /* namespace AMDA */
#endif