| 1978 | template<class Handler> |
| 1979 | template<bool StackEmpty_, char First_, number_precision Numbers_> |
| 1980 | const char* |
| 1981 | basic_parser<Handler>:: |
| 1982 | parse_number(const char* p, |
| 1983 | std::integral_constant<bool, StackEmpty_> stack_empty, |
| 1984 | std::integral_constant<char, First_> first, |
| 1985 | std::integral_constant<number_precision, Numbers_> mode) |
| 1986 | { |
| 1987 | constexpr bool precise_parsing = mode == number_precision::precise; |
| 1988 | constexpr bool no_parsing = mode == number_precision::none; |
| 1989 | |
| 1990 | // only one of these will be true if we are not resuming |
| 1991 | // if negative then !zero_first && !nonzero_first |
| 1992 | // if zero_first then !nonzero_first && !negative |
| 1993 | // if nonzero_first then !zero_first && !negative |
| 1994 | bool const negative = first == '-'; |
| 1995 | bool const zero_first = first == '0'; |
| 1996 | bool const nonzero_first = first == '+'; |
| 1997 | detail::const_stream_wrapper cs(p, end_); |
| 1998 | number num; |
| 1999 | const char* begin = cs.begin(); |
| 2000 | if(stack_empty || st_.empty()) |
| 2001 | { |
| 2002 | num.bias = 0; |
| 2003 | num.exp = 0; |
| 2004 | num.frac = false; |
| 2005 | num_buf_.clear(); |
| 2006 | |
| 2007 | //---------------------------------- |
| 2008 | // |
| 2009 | // '-' |
| 2010 | // leading minus sign |
| 2011 | // |
| 2012 | BOOST_ASSERT(cs); |
| 2013 | if(negative) |
| 2014 | ++cs; |
| 2015 | |
| 2016 | num.neg = negative; |
| 2017 | num.frac = false; |
| 2018 | num.exp = 0; |
| 2019 | num.bias = 0; |
| 2020 | |
| 2021 | // fast path |
| 2022 | if( cs.remain() >= 16 + 1 + 16 ) // digits . digits |
| 2023 | { |
| 2024 | int n1; |
| 2025 | |
| 2026 | if( nonzero_first || |
| 2027 | (negative && *cs != '0') ) |
| 2028 | { |
| 2029 | n1 = detail::count_digits( cs.begin() ); |
| 2030 | BOOST_ASSERT(n1 >= 0 && n1 <= 16); |
| 2031 | |
| 2032 | if( negative && n1 == 0 && opt_.allow_infinity_and_nan ) |
| 2033 | { |
| 2034 | return parse_literal( |
| 2035 | p - 1, |
| 2036 | detail::literals_c<detail::literals::neg_infinity>()); |
| 2037 | } |
nothing calls this directly
no test coverage detected