| 788 | template<class Handler> |
| 789 | template<class Literal> |
| 790 | const char* |
| 791 | basic_parser<Handler>:: |
| 792 | parse_literal(const char* p, Literal) |
| 793 | { |
| 794 | using L = detail::literals; |
| 795 | |
| 796 | std::size_t cur_lit; |
| 797 | std::size_t offset; |
| 798 | |
| 799 | detail::const_stream_wrapper cs(p, end_); |
| 800 | BOOST_IF_CONSTEXPR( Literal::value != L::resume ) |
| 801 | { |
| 802 | constexpr std::size_t index = literal_index(Literal::value); |
| 803 | constexpr char const* literal = detail::literal_strings[index]; |
| 804 | constexpr std::size_t sz = detail::literal_sizes[index]; |
| 805 | |
| 806 | if(BOOST_JSON_LIKELY( cs.remain() >= sz )) |
| 807 | { |
| 808 | int const cmp = std::memcmp(cs.begin(), literal, sz); |
| 809 | if( cmp != 0 ) |
| 810 | { |
| 811 | BOOST_STATIC_CONSTEXPR source_location loc = BOOST_CURRENT_LOCATION; |
| 812 | return fail(cs.begin(), error::syntax, &loc); |
| 813 | } |
| 814 | |
| 815 | BOOST_IF_CONSTEXPR( Literal::value == L::null ) |
| 816 | { |
| 817 | if(BOOST_JSON_UNLIKELY( |
| 818 | ! h_.on_null(ec_))) |
| 819 | return fail(cs.begin()); |
| 820 | } |
| 821 | else BOOST_IF_CONSTEXPR( Literal::value == L::true_ ) |
| 822 | { |
| 823 | if(BOOST_JSON_UNLIKELY( |
| 824 | ! h_.on_bool(true, ec_))) |
| 825 | return fail(cs.begin()); |
| 826 | } |
| 827 | else BOOST_IF_CONSTEXPR( Literal::value == L::false_ ) |
| 828 | { |
| 829 | if(BOOST_JSON_UNLIKELY( |
| 830 | ! h_.on_bool(false, ec_))) |
| 831 | return fail(cs.begin()); |
| 832 | } |
| 833 | else BOOST_IF_CONSTEXPR( Literal::value == L::infinity ) |
| 834 | { |
| 835 | if(BOOST_JSON_UNLIKELY( |
| 836 | ! h_.on_double( |
| 837 | std::numeric_limits<double>::infinity(), |
| 838 | string_view(literal, sz), |
| 839 | ec_))) |
| 840 | return fail(cs.begin()); |
| 841 | } |
| 842 | else BOOST_IF_CONSTEXPR( Literal::value == L::neg_infinity ) |
| 843 | { |
| 844 | if(BOOST_JSON_UNLIKELY( |
| 845 | ! h_.on_double( |
| 846 | -std::numeric_limits<double>::infinity(), |
| 847 | string_view(literal, sz), |
nothing calls this directly
no test coverage detected