MCPcopy Create free account
hub / github.com/boostorg/json / parse_object

Method parse_object

include/boost/json/basic_parser_impl.hpp:1698–1857  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1696 bool AllowTrailing_,
1697 bool AllowBadUTF8_*/>
1698const char*
1699basic_parser<Handler>::
1700parse_object(const char* p,
1701 std::integral_constant<bool, StackEmpty_> stack_empty,
1702 std::integral_constant<bool, AllowComments_> allow_comments,
1703 /*std::integral_constant<bool, AllowTrailing_>*/ bool allow_trailing,
1704 /*std::integral_constant<bool, AllowBadUTF8_>*/ bool allow_bad_utf8,
1705 bool allow_bad_utf16)
1706{
1707 detail::const_stream_wrapper cs(p, end_);
1708 std::size_t size;
1709 if(! stack_empty && ! st_.empty())
1710 {
1711 // resume
1712 state st;
1713 st_.pop(st);
1714 st_.pop(size);
1715 switch(st)
1716 {
1717 default: BOOST_JSON_UNREACHABLE();
1718 case state::obj1: goto do_obj1;
1719 case state::obj2: goto do_obj2;
1720 case state::obj3: goto do_obj3;
1721 case state::obj4: goto do_obj4;
1722 case state::obj5: goto do_obj5;
1723 case state::obj6: goto do_obj6;
1724 case state::obj7: goto do_obj7;
1725 case state::obj8: goto do_obj8;
1726 case state::obj9: goto do_obj9;
1727 case state::obj10: goto do_obj10;
1728 case state::obj11: goto do_obj11;
1729 }
1730 }
1731 BOOST_ASSERT(*cs == '{');
1732 size = 0;
1733 if(BOOST_JSON_UNLIKELY(! depth_))
1734 {
1735 BOOST_STATIC_CONSTEXPR source_location loc = BOOST_CURRENT_LOCATION;
1736 return fail(cs.begin(), error::too_deep, &loc);
1737 }
1738 --depth_;
1739 if(BOOST_JSON_UNLIKELY(
1740 ! h_.on_object_begin(ec_)))
1741 return fail(cs.begin());
1742 ++cs;
1743 // object:
1744 // '{' *ws '}'
1745 // '{' *ws string *ws ':' *ws value *ws *[ ',' *ws string *ws ':' *ws value *ws ] '}'
1746do_obj1:
1747 cs = detail::count_whitespace(cs.begin(), cs.end());
1748 if(BOOST_JSON_UNLIKELY(! cs))
1749 return maybe_suspend(cs.begin(), state::obj1, size);
1750 if(BOOST_JSON_LIKELY(*cs != '}'))
1751 {
1752 if(BOOST_JSON_UNLIKELY(*cs != '\x22'))
1753 {
1754 if(allow_comments && *cs == '/')
1755 {

Callers

nothing calls this directly

Calls 8

count_whitespaceFunction · 0.85
parse_valueFunction · 0.85
popMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
on_object_beginMethod · 0.45
endMethod · 0.45
on_object_endMethod · 0.45

Tested by

no test coverage detected