34 if constexpr( ParseState::minified_document ) {
37 using CharT =
typename ParseState::CharT;
39 CharT *first = parse_state.first;
41 CharT *
const last = parse_state.last;
46 if constexpr( ParseState::is_zero_terminated_string ) {
49 (
static_cast<unsigned>(
static_cast<unsigned char>( *first ) ) -
56 DAW_LIKELY( first < last ) and
57 (
static_cast<unsigned>(
static_cast<unsigned char>( *first ) ) -
62 parse_state.first = first;
96 static_assert(
sizeof...( keys ) > 0 );
97 static_assert(
sizeof...( keys ) <= 16 );
99 using CharT =
typename ParseState::CharT;
101 if constexpr( daw::traits::not_same<
typename ParseState::exec_tag_t,
104 json_details::mempbrk<ParseState::is_unchecked_input,
105 typename ParseState::exec_tag_t,
106 ParseState::expect_long_strings, keys...>(
107 parse_state.first, parse_state.last );
109 CharT *first = parse_state.first;
110 CharT *
const last = parse_state.last;
116 if( ParseState::is_zero_terminated_string ) {
118 ErrorReason::UnexpectedEndOfData,
120 while( not parse_policy_details::in<keys...>( *first ) ) {
127 first < last, ErrorReason::UnexpectedEndOfData, parse_state );
128 while( not parse_policy_details::in<keys...>( *first ) ) {
131 first < last, ErrorReason::UnexpectedEndOfData, parse_state );
134 parse_state.first = first;
145 constexpr char PrimRight = PrimLeft ==
'{' ?
'}' :
']';
146 constexpr char SecLeft = PrimLeft ==
'{' ?
'[' :
'{';
147 constexpr char SecRight = SecLeft ==
'{' ?
'}' :
']';
149 using CharT =
typename ParseState::CharT;
151 CharT *ptr_first = parse_state.first;
152 CharT *
const ptr_last = parse_state.last;
153 if( DAW_UNLIKELY( ptr_first >= ptr_last ) ) {
156 auto result = parse_state;
158 std::uint32_t prime_bracket_count = 1;
159 std::uint32_t second_bracket_count = 0;
161 if( *ptr_first == PrimLeft ) {
164 while( DAW_LIKELY( ptr_first < ptr_last ) ) {
165 switch( *ptr_first ) {
171 ptr_first = json_details::mem_skip_until_end_of_string<
172 ParseState::is_unchecked_input>( ParseState::exec_tag, ptr_first,
175 ErrorReason::UnexpectedEndOfData, parse_state );
178 if( DAW_UNLIKELY( ( prime_bracket_count == 1 ) &
179 ( second_bracket_count == 0 ) ) ) {
184 ++prime_bracket_count;
187 --prime_bracket_count;
188 if( prime_bracket_count == 0 ) {
191 ErrorReason::InvalidBracketing, parse_state );
192 result.last = ptr_first;
193 result.counter = cnt;
194 parse_state.first = ptr_first;
199 ++second_bracket_count;
202 --second_bracket_count;
208 ( second_bracket_count == 0 ),
209 ErrorReason::InvalidBracketing, parse_state );
212 result.last = ptr_first;
213 result.counter = cnt;
214 parse_state.first = ptr_first;
222 constexpr char PrimRight = PrimLeft ==
'{' ?
'}' :
']';
223 constexpr char SecLeft = PrimLeft ==
'{' ?
'[' :
'{';
224 constexpr char SecRight = SecLeft ==
'{' ?
'}' :
']';
225 using CharT =
typename ParseState::CharT;
226 auto result = parse_state;
228 std::uint32_t prime_bracket_count = 1;
229 std::uint32_t second_bracket_count = 0;
230 CharT *ptr_first = parse_state.first;
232 if( *ptr_first == PrimLeft ) {
236 switch( *ptr_first ) {
242 ptr_first = json_details::mem_skip_until_end_of_string<
243 ParseState::is_unchecked_input>( ParseState::exec_tag, ptr_first,
247 if( DAW_UNLIKELY( ( prime_bracket_count == 1 ) &
248 ( second_bracket_count == 0 ) ) ) {
253 ++prime_bracket_count;
256 --prime_bracket_count;
257 if( prime_bracket_count == 0 ) {
261 result.last = ptr_first;
262 result.counter = cnt;
263 parse_state.first = ptr_first;
268 ++second_bracket_count;
271 --second_bracket_count;