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( );
48 parse_state.remove_prefix( );
60 while( parse_state.has_more( ) and parse_state.front( ) ==
'/' ) {
61 if( not parse_state.has_more( ) ) {
64 switch( *( parse_state.first + 1 ) ) {
66 parse_state.template move_to_next_of_checked<'\n'>( );
67 if( parse_state.has_more( ) ) {
68 parse_state.remove_prefix( );
72 parse_state.remove_prefix( 2 );
73 while( parse_state.has_more( ) ) {
74 parse_state.template move_to_next_of_checked<'*'>( );
75 if( parse_state.has_more( ) ) {
76 parse_state.remove_prefix( );
78 if( not parse_state.has_more( ) ) {
80 }
else if( parse_state.front( ) ==
'/' ) {
81 parse_state.remove_prefix( );
84 parse_state.remove_prefix( );
107 skip_comments_checked( parse_state );
108 while( parse_state.has_more( ) and parse_state.is_space_unchecked( ) ) {
109 parse_state.remove_prefix( );
110 skip_comments_checked( parse_state );
132 skip_comments( parse_state );
134 ErrorReason::UnexpectedEndOfData,
136 while( not parse_policy_details::in<keys...>( parse_state.front( ) ) ) {
138 ErrorReason::UnexpectedEndOfData,
140 parse_state.remove_prefix( );
141 skip_comments( parse_state );
153 DAW_CPP23_STATIC_LOCAL
constexpr char PrimLeft =
154 BracketedType == json_details::SkipBracketedType::Class ?
'{' :
'[';
155 using PrimRight = daw::constant<PrimLeft ==
'{' ?
'}' :
']'>;
156 using SecLeft = daw::constant<PrimLeft ==
'{' ?
'[' :
'{'>;
157 using SecRight = daw::constant<SecLeft::value ==
'{' ?
'}' :
']'>;
159 auto result = parse_state;
161 std::uint32_t prime_bracket_count = 1;
162 std::uint32_t second_bracket_count = 0;
163 auto ptr_first = daw::not_null( parse_state.first );
164 auto const ptr_last = daw::not_null( parse_state.last );
165 if( DAW_UNLIKELY( ptr_first >= ptr_last ) ) {
168 if( *ptr_first == PrimLeft ) {
171 while( DAW_LIKELY( ptr_first < ptr_last ) ) {
172 switch( *ptr_first ) {
178 if constexpr( std::is_same_v<
char *,
179 typename ParseState::iterator> ) {
180 auto skip_ptr = json_details::mem_skip_until_end_of_string<
181 ParseState::is_unchecked_input,
182 typename ParseState::exec_tag_t>( ptr_first.get( ),
184 ptr_first += skip_ptr - ptr_first.get( );
186 ptr_first = json_details::mem_skip_until_end_of_string<
187 ParseState::is_unchecked_input,
188 typename ParseState::exec_tag_t>( ptr_first, ptr_last );
191 ErrorReason::UnexpectedEndOfData,
195 if( prime_bracket_count == 1 and second_bracket_count == 0 ) {
200 ++prime_bracket_count;
202 case PrimRight::value:
203 --prime_bracket_count;
204 if( prime_bracket_count == 0 ) {
206 ErrorReason::InvalidBracketing,
211 result.last = ptr_first;
212 result.counter = cnt;
213 parse_state.first = ptr_first;
218 ++second_bracket_count;
220 case SecRight::value:
221 --second_bracket_count;
226 ErrorReason::UnexpectedEndOfData,
228 switch( *ptr_first ) {
231 while( ( ptr_last - ptr_first ) > 1 and *ptr_first !=
'\n' ) {
237 while( ( ptr_last - ptr_first ) >= 3 and *ptr_first !=
'*' and
238 *std::next( ptr_first.get( ) ) !=
'/' ) {
250 ( second_bracket_count == 0 ),
251 ErrorReason::InvalidBracketing,
255 result.last = ptr_first;
256 result.counter = cnt;
257 parse_state.first = ptr_first;
265 DAW_CPP23_STATIC_LOCAL
constexpr char PrimLeft =
266 BracketedType == json_details::SkipBracketedType::Class ?
'{' :
'[';
267 using PrimRight = daw::constant<PrimLeft ==
'{' ?
'}' :
']'>;
268 using SecLeft = daw::constant<PrimLeft ==
'{' ?
'[' :
'{'>;
269 using SecRight = daw::constant<SecLeft::value ==
'{' ?
'}' :
']'>;
272 auto result = parse_state;
274 std::uint32_t prime_bracket_count = 1;
275 std::uint32_t second_bracket_count = 0;
276 auto ptr_first = daw::not_null( daw::never_null, parse_state.first );
277 auto const ptr_last =
278 daw::not_null( daw::never_null, parse_state.last );
279 if( *ptr_first == PrimLeft ) {
283 switch( *ptr_first ) {
289 if constexpr( std::is_same_v<
char *,
290 typename ParseState::iterator> ) {
291 auto skip_ptr = json_details::mem_skip_until_end_of_string<
292 ParseState::is_unchecked_input,
293 typename ParseState::exec_tag_t>( ptr_first.get( ),
295 ptr_first += skip_ptr - ptr_first.get( );
297 ptr_first = json_details::mem_skip_until_end_of_string<
298 ParseState::is_unchecked_input,
299 typename ParseState::exec_tag_t>( ptr_first, ptr_last );
303 if( prime_bracket_count == 1 and second_bracket_count == 0 ) {
308 ++prime_bracket_count;
310 case PrimRight::value:
311 --prime_bracket_count;
312 if( prime_bracket_count == 0 ) {
316 result.last = ptr_first;
317 result.counter = cnt;
318 parse_state.first = ptr_first;
323 ++second_bracket_count;
325 case SecRight::value:
326 --second_bracket_count;
330 switch( *ptr_first ) {
333 while( *ptr_first !=
'\n' ) {
339 while( *ptr_first !=
'*' and
340 *std::next( ptr_first.get( ) ) !=
'/' ) {