| 2810 | } |
| 2811 | |
| 2812 | std::shared_ptr<value<double>> parse_float(std::string::iterator& it, |
| 2813 | const std::string::iterator& end) |
| 2814 | { |
| 2815 | std::string v{it, end}; |
| 2816 | v.erase(std::remove(v.begin(), v.end(), '_'), v.end()); |
| 2817 | it = end; |
| 2818 | char decimal_point = std::localeconv()->decimal_point[0]; |
| 2819 | std::replace(v.begin(), v.end(), '.', decimal_point); |
| 2820 | try |
| 2821 | { |
| 2822 | return make_value<double>(std::stod(v)); |
| 2823 | } |
| 2824 | catch (const std::invalid_argument& ex) |
| 2825 | { |
| 2826 | throw_parse_exception("Malformed number (invalid argument: " |
| 2827 | + std::string{ex.what()} + ")"); |
| 2828 | } |
| 2829 | catch (const std::out_of_range& ex) |
| 2830 | { |
| 2831 | throw_parse_exception("Malformed number (out of range: " |
| 2832 | + std::string{ex.what()} + ")"); |
| 2833 | } |
| 2834 | } |
| 2835 | |
| 2836 | std::shared_ptr<value<bool>> parse_bool(std::string::iterator& it, |
| 2837 | const std::string::iterator& end) |
no test coverage detected