4 #include <ail/types.hpp>
5 #include <ail/exception.hpp>
6 #include <fridh/construction.hpp>
10 namespace variable_type_identifier
33 typedef variable_type_identifier::type variable_type
;
38 typedef word signed_integer
;
39 typedef uword unsigned_integer
;
40 typedef double floating_point_value
;
41 typedef std::string string
;
42 typedef std::vector
<variable
> vector
;
43 typedef std::map
<variable
, variable
> map
;
50 variable(variable
const & other
);
53 variable_type
get_type() const;
57 void new_boolean(types::boolean new_boolean
);
58 void new_signed_integer(types::signed_integer new_signed_integer
);
59 void new_unsigned_integer(types::unsigned_integer new_unsigned_integer
);
60 void new_floating_point_value(types::floating_point_value new_floating_point_value
);
61 void new_string(types::string
const & new_string
);
65 #define DECLARE_UNARY_OPERATOR(name) void name(variable & output) const;
66 #define DECLARE_BINARY_OPERATOR(name) void name(variable const & argument, variable & output) const;
68 DECLARE_BINARY_OPERATOR(addition
)
69 DECLARE_BINARY_OPERATOR(subtraction
)
70 DECLARE_BINARY_OPERATOR(multiplication
)
71 DECLARE_BINARY_OPERATOR(division
)
72 DECLARE_BINARY_OPERATOR(modulo
)
74 DECLARE_BINARY_OPERATOR(negation
)
76 DECLARE_BINARY_OPERATOR(less_than
)
77 DECLARE_BINARY_OPERATOR(less_than_or_equal
)
78 DECLARE_BINARY_OPERATOR(greater_than
)
79 DECLARE_BINARY_OPERATOR(greater_than_or_equal
)
80 DECLARE_BINARY_OPERATOR(not_equal
)
81 DECLARE_BINARY_OPERATOR(equal
)
83 DECLARE_UNARY_OPERATOR(logical_not
)
85 DECLARE_BINARY_OPERATOR(logical_and
)
86 DECLARE_BINARY_OPERATOR(logical_or
)
88 DECLARE_BINARY_OPERATOR(shift_left
)
89 DECLARE_BINARY_OPERATOR(shift_right
)
91 DECLARE_BINARY_OPERATOR(binary_and
)
92 DECLARE_BINARY_OPERATOR(binary_or
)
93 DECLARE_BINARY_OPERATOR(binary_xor
)
95 DECLARE_UNARY_OPERATOR(binary_not
)
97 DECLARE_UNARY_OPERATOR(negation
)
99 #undef DECLARE_UNARY_OPERATOR
100 #undef DECLARE_BINARY_OPERATOR
102 bool operator==(variable
const & other
) const;
103 bool operator!=(variable
const & other
) const;
104 bool operator<(variable
const & other
) const;
106 variable
& operator=(variable
const & other
);
108 void copy(variable
const & other
);
115 types::boolean boolean
;
116 types::signed_integer signed_integer
;
117 types::unsigned_integer unsigned_integer
;
118 types::floating_point_value floating_point_value
;
119 types::string
* string
;
120 types::vector
* array
;
122 function
* function_pointer
;
128 bool is_floating_point_operation(variable
const & argument
) const;
129 bool is_integer_type() const;
130 bool is_numeric_type() const;
131 bool is_zero() const;
133 types::floating_point_value
get_floating_point_value() const;
134 std::string
get_string_representation() const;
135 bool get_boolean_value() const;
137 bool array_addition(variable
const & argument
, variable
& output
) const;
138 bool string_addition(variable
const & argument
, variable
& output
) const;
140 bool array_equality(variable
const & other
) const;
141 bool map_equality(variable
const & other
) const;
143 uword
array_hash(uword previous_hash
) const;
144 uword
map_hash(uword previous_hash
) const;
145 uword
hash(uword previous_hash
= 0) const;
148 std::string
get_type_string(variable_type type
);
150 void unary_argument_type_error(std::string
const & operation
, variable_type type
);
151 void binary_argument_type_error(std::string
const & operation
, variable_type left
, variable_type right
);