33 while( parse_state.front( ) ==
'/' ) {
34 switch( *( parse_state.first + 1 ) ) {
36 parse_state.template move_to_next_of_unchecked<'\n'>( );
37 parse_state.remove_prefix( );
40 parse_state.remove_prefix( 2 );
42 parse_state.template move_to_next_of_unchecked<'*'>( );
43 parse_state.remove_prefix( );
44 if( parse_state.front( ) ==
'/' ) {
45 parse_state.remove_prefix( );
60 while( parse_state.has_more( ) and parse_state.front( ) ==
'/' ) {
63 if( not ParseState::is_zero_terminated_string and
64 parse_state.size( ) < 2 ) {
67 switch( *( parse_state.first + 1 ) ) {
69 parse_state.template move_to_next_of_checked<'\n'>( );
70 if( parse_state.has_more( ) ) {
71 parse_state.remove_prefix( );
75 parse_state.remove_prefix( 2 );
76 while( parse_state.has_more( ) ) {
77 parse_state.template move_to_next_of_checked<'*'>( );
78 if( parse_state.has_more( ) ) {
79 parse_state.remove_prefix( );
81 if( not parse_state.has_more( ) ) {
83 }
else if( parse_state.front( ) ==
'/' ) {
84 parse_state.remove_prefix( );
110 skip_comments_checked( parse_state );
111 while( parse_state.has_more( ) and parse_state.is_space_unchecked( ) ) {
112 parse_state.remove_prefix( );
113 skip_comments_checked( parse_state );
137 skip_comments( parse_state );
141 ErrorReason::UnexpectedEndOfData,
143 if( parse_policy_details::in<keys...>( parse_state.front( ) ) ) {
146 parse_state.remove_prefix( );
147 skip_comments( parse_state );
159 DAW_CPP23_STATIC_LOCAL
constexpr char PrimLeft =
160 BracketedType == json_details::SkipBracketedType::Class ?
'{' :
'[';
161 using PrimRight = daw::constant<PrimLeft ==
'{' ?
'}' :
']'>;
162 using SecLeft = daw::constant<PrimLeft ==
'{' ?
'[' :
'{'>;
163 using SecRight = daw::constant<SecLeft::value ==
'{' ?
'}' :
']'>;
165 auto result = parse_state;
167 std::uint32_t prime_bracket_count = 1;
168 std::uint32_t second_bracket_count = 0;
169 auto ptr_first = parse_state.first;
170 auto const ptr_last = parse_state.last;
173 ErrorReason::InvalidNull );
174 if( DAW_UNLIKELY( ptr_first >= ptr_last ) ) {
177 if( *ptr_first == PrimLeft ) {
180 while( DAW_LIKELY( ptr_first < ptr_last ) ) {
181 switch( *ptr_first ) {
188 ptr_first += json_details::mem_skip_until_end_of_string<
189 ParseState::is_unchecked_input,
190 typename ParseState::exec_tag_t>(
191 daw::not_null<char const *>( daw::never_null, ptr_first ),
192 daw::not_null<char const *>( daw::never_null, ptr_last ) )
196 ErrorReason::UnexpectedEndOfData,
200 if( prime_bracket_count == 1 and second_bracket_count == 0 ) {
205 ++prime_bracket_count;
207 case PrimRight::value:
208 --prime_bracket_count;
209 if( prime_bracket_count == 0 ) {
211 ErrorReason::InvalidBracketing,
216 result.last = ptr_first;
217 result.counter = cnt;
218 parse_state.first = ptr_first;
223 ++second_bracket_count;
225 case SecRight::value:
226 --second_bracket_count;
231 ErrorReason::UnexpectedEndOfData,
233 switch( *ptr_first ) {
236 while( ( ptr_last - ptr_first ) > 1 and *ptr_first !=
'\n' ) {
243 while( ( ptr_last - ptr_first ) >= 2 and
244 not( *ptr_first ==
'*' and
245 *std::next( ptr_first ) ==
'/' ) ) {
249 ErrorReason::UnexpectedEndOfData,
263 ( second_bracket_count == 0 ),
264 ErrorReason::InvalidBracketing,
268 result.last = ptr_first;
269 result.counter = cnt;
270 parse_state.first = ptr_first;
278 DAW_CPP23_STATIC_LOCAL
constexpr char PrimLeft =
279 BracketedType == json_details::SkipBracketedType::Class ?
'{' :
'[';
280 using PrimRight = daw::constant<PrimLeft ==
'{' ?
'}' :
']'>;
281 using SecLeft = daw::constant<PrimLeft ==
'{' ?
'[' :
'{'>;
282 using SecRight = daw::constant<SecLeft::value ==
'{' ?
'}' :
']'>;
285 auto result = parse_state;
287 std::uint32_t prime_bracket_count = 1;
288 std::uint32_t second_bracket_count = 0;
289 auto ptr_first = parse_state.first;
290 auto const ptr_last = parse_state.last;
293 ErrorReason::InvalidNull );
294 if( *ptr_first == PrimLeft ) {
298 switch( *ptr_first ) {
305 ptr_first += json_details::mem_skip_until_end_of_string<
306 ParseState::is_unchecked_input,
307 typename ParseState::exec_tag_t>(
308 daw::not_null<char const *>( daw::never_null, ptr_first ),
309 daw::not_null<char const *>( daw::never_null, ptr_last ) )
314 if( prime_bracket_count == 1 and second_bracket_count == 0 ) {
319 ++prime_bracket_count;
321 case PrimRight::value:
322 --prime_bracket_count;
323 if( prime_bracket_count == 0 ) {
327 result.last = ptr_first;
328 result.counter = cnt;
329 parse_state.first = ptr_first;
334 ++second_bracket_count;
336 case SecRight::value:
337 --second_bracket_count;
341 switch( *ptr_first ) {
344 while( *ptr_first !=
'\n' ) {
351 while( not( *ptr_first ==
'*' and
352 *std::next( ptr_first ) ==
'/' ) ) {