4 #include <ail/types.hpp>
5 #include <ail/exceptionh.pp>
9 namespace variable_type_identifier
31 typedef variable_type_identifier::variable_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(unequal
)
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 #undef DECLARE_UNARY_OPERATOR
98 #undef DECLARE_BINARY_OPERATOR
100 bool operator==(variable
const & other
) const;
101 bool operator!=(variable
const & other
) const;
102 bool operator<(variable
const & other
) const;
107 types::boolean boolean
;
108 types::signed_integer signed_integer
;
109 types::unsigned_integer unsigned_integer
;
110 types::floating_point_value floating_point_value
;
111 types::string
* string
;
112 types::vector
* array
;
114 function
* function_pointer
;
120 bool is_floating_point_operation(variable
& argument
) const;
121 bool is_integer_type() const;
122 bool is_numeric_type() const;
123 bool is_zero() const;
125 types::floating_point_value
get_floating_point_value() const;
126 std::string
get_string_representation() const;
127 bool get_boolean_value() const;
129 bool variable::array_addition(variable
const & argument
) const
130 bool string_addition(variable
const & argument
, variable
& output
) const;
132 bool array_equality(variable
const & other
) const;
133 bool map_equality(variable
const & other
) const;
135 uword
array_hash(uword previous_hash
) const;
136 uword
map_hash(uword previous_hash
) const;
137 uword
hash(uword previous_hash
= 0) const;
140 std::string
get_type_string(variable_type type
);
142 void unary_argument_type_error(std::string
const & operation
, variable_type type
);
143 void binary_argument_type_error(std::string
const & operation
, variable_type left
, variable_type right
);