1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3 Copyright (c) 2001-2011 Hartmut Kaiser
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 =============================================================================*/
8 #if !defined(BOOST_SPIRIT_CONJURE_IDS_HPP)
9 #define BOOST_SPIRIT_CONJURE_IDS_HPP
67 template <int type, int op>
70 static int const value = type + op;
73 template <op::type op>
74 struct unary_op : make_op<op_type::unary, op> {};
76 template <op::type op>
78 : make_op<op_type::binary, op> {};
80 template <op::type op>
82 : make_op<op_type::assign, op> {};
84 template <op::type op>
85 struct binary_or_unary_op
86 : make_op<op_type::unary | op_type::binary, op> {};
94 op_binary = op_type::binary,
95 op_unary = op_type::unary,
96 op_assign = op_type::assign,
98 // binary / unary operators with common tokens
99 // '+' and '-' can be binary or unary
100 // (the lexer cannot distinguish which)
101 plus = binary_or_unary_op<op::plus>::value,
102 minus = binary_or_unary_op<op::minus>::value,
105 comma = binary_op<op::comma>::value,
106 assign = assign_op<op::assign>::value,
107 plus_assign = assign_op<op::plus_assign>::value,
108 minus_assign = assign_op<op::minus_assign>::value,
109 times_assign = assign_op<op::times_assign>::value,
110 divide_assign = assign_op<op::divide_assign>::value,
111 mod_assign = assign_op<op::mod_assign>::value,
112 bit_and_assign = assign_op<op::bit_and_assign>::value,
113 bit_xor_assign = assign_op<op::bit_xor_assign>::value,
114 bit_or_assign = assign_op<op::bit_or_assign>::value,
115 shift_left_assign = assign_op<op::shift_left_assign>::value,
116 shift_right_assign = assign_op<op::shift_right_assign>::value,
117 logical_or = binary_op<op::logical_or>::value,
118 logical_and = binary_op<op::logical_and>::value,
119 bit_or = binary_op<op::bit_or>::value,
120 bit_xor = binary_op<op::bit_xor>::value,
121 bit_and = binary_op<op::bit_and>::value,
122 equal = binary_op<op::equal>::value,
123 not_equal = binary_op<op::not_equal>::value,
124 less = binary_op<op::less>::value,
125 less_equal = binary_op<op::less_equal>::value,
126 greater = binary_op<op::greater>::value,
127 greater_equal = binary_op<op::greater_equal>::value,
128 shift_left = binary_op<op::shift_left>::value,
129 shift_right = binary_op<op::shift_right>::value,
130 times = binary_op<op::times>::value,
131 divide = binary_op<op::divide>::value,
132 mod = binary_op<op::mod>::value,
134 // unary operators with overlaps
135 // '++' and '--' can be prefix or postfix
136 // (the lexer cannot distinguish which)
137 plus_plus = unary_op<op::plus_plus>::value,
138 minus_minus = unary_op<op::minus_minus>::value,
141 compl_ = unary_op<op::compl_>::value,
142 not_ = unary_op<op::not_>::value,
145 identifier = op::not_ + 1,