| 420 | bool StackEmpty_/*, |
| 421 | bool Terminal_*/> |
| 422 | const char* |
| 423 | basic_parser<Handler>:: |
| 424 | parse_comment(const char* p, |
| 425 | std::integral_constant<bool, StackEmpty_> stack_empty, |
| 426 | /*std::integral_constant<bool, Terminal_>*/ bool terminal) |
| 427 | { |
| 428 | detail::const_stream_wrapper cs(p, end_); |
| 429 | const char* start = cs.begin(); |
| 430 | std::size_t remain; |
| 431 | if(! stack_empty && ! st_.empty()) |
| 432 | { |
| 433 | state st; |
| 434 | st_.pop(st); |
| 435 | switch(st) |
| 436 | { |
| 437 | default: BOOST_JSON_UNREACHABLE(); |
| 438 | case state::com1: goto do_com1; |
| 439 | case state::com2: goto do_com2; |
| 440 | case state::com3: goto do_com3; |
| 441 | case state::com4: goto do_com4; |
| 442 | } |
| 443 | } |
| 444 | BOOST_ASSERT(*cs == '/'); |
| 445 | ++cs; |
| 446 | do_com1: |
| 447 | if(BOOST_JSON_UNLIKELY(! cs)) |
| 448 | return maybe_suspend(cs.begin(), state::com1); |
| 449 | switch(*cs) |
| 450 | { |
| 451 | default: |
| 452 | { |
| 453 | BOOST_STATIC_CONSTEXPR source_location loc |
| 454 | = BOOST_CURRENT_LOCATION; |
| 455 | return fail(cs.begin(), error::syntax, &loc); |
| 456 | } |
| 457 | case '/': |
| 458 | ++cs; |
| 459 | do_com2: |
| 460 | // KRYSTIAN TODO: this is a mess, we have to fix this |
| 461 | remain = cs.remain(); |
| 462 | cs = remain ? static_cast<const char*>( |
| 463 | std::memchr(cs.begin(), '\n', remain)) : sentinel(); |
| 464 | if(! cs.begin()) |
| 465 | cs = sentinel(); |
| 466 | if(BOOST_JSON_UNLIKELY(incomplete(cs))) |
| 467 | { |
| 468 | // if the doc does not terminate |
| 469 | // with a newline, treat it as the |
| 470 | // end of the comment |
| 471 | if(terminal && ! more_) |
| 472 | { |
| 473 | if(BOOST_JSON_UNLIKELY(! h_.on_comment( |
| 474 | {start, cs.remain(start)}, ec_))) |
| 475 | return fail(cs.end()); |
| 476 | return cs.end(); |
| 477 | } |
| 478 | if(BOOST_JSON_UNLIKELY(! h_.on_comment_part( |
| 479 | {start, cs.remain(start)}, ec_))) |
nothing calls this directly
no test coverage detected