| 8945 | } |
| 8946 | |
| 8947 | double eval_number(const xpath_context& c, const xpath_stack& stack) |
| 8948 | { |
| 8949 | switch (_type) |
| 8950 | { |
| 8951 | case ast_op_add: return _left->eval_number(c, stack) + _right->eval_number(c, stack); |
| 8952 | |
| 8953 | case ast_op_subtract: return _left->eval_number(c, stack) - _right->eval_number(c, stack); |
| 8954 | |
| 8955 | case ast_op_multiply: return _left->eval_number(c, stack) * _right->eval_number(c, stack); |
| 8956 | |
| 8957 | case ast_op_divide: return _left->eval_number(c, stack) / _right->eval_number(c, stack); |
| 8958 | |
| 8959 | case ast_op_mod: return fmod(_left->eval_number(c, stack), _right->eval_number(c, stack)); |
| 8960 | |
| 8961 | case ast_op_negate: return -_left->eval_number(c, stack); |
| 8962 | |
| 8963 | case ast_number_constant: return _data.number; |
| 8964 | |
| 8965 | case ast_func_last: return static_cast<double>(c.size); |
| 8966 | |
| 8967 | case ast_func_position: return static_cast<double>(c.position); |
| 8968 | |
| 8969 | case ast_func_count: |
| 8970 | { |
| 8971 | xpath_allocator_capture cr(stack.result); |
| 8972 | |
| 8973 | return static_cast<double>(_left->eval_node_set(c, stack).size()); |
| 8974 | } |
| 8975 | |
| 8976 | case ast_func_string_length_0: |
| 8977 | { |
| 8978 | xpath_allocator_capture cr(stack.result); |
| 8979 | |
| 8980 | return static_cast<double>(string_value(c.n, stack.result).length()); |
| 8981 | } |
| 8982 | |
| 8983 | case ast_func_string_length_1: |
| 8984 | { |
| 8985 | xpath_allocator_capture cr(stack.result); |
| 8986 | |
| 8987 | return static_cast<double>(_left->eval_string(c, stack).length()); |
| 8988 | } |
| 8989 | |
| 8990 | case ast_func_number_0: |
| 8991 | { |
| 8992 | xpath_allocator_capture cr(stack.result); |
| 8993 | |
| 8994 | return convert_string_to_number(string_value(c.n, stack.result).c_str()); |
| 8995 | } |
| 8996 | |
| 8997 | case ast_func_number_1: return _left->eval_number(c, stack); |
| 8998 | |
| 8999 | case ast_func_sum: |
| 9000 | { |
| 9001 | xpath_allocator_capture cr(stack.result); |
| 9002 | |
| 9003 | double r = 0; |
| 9004 |
no test coverage detected