307 _RYML_ASSERT_BASIC(m_evt_handler);
308 m_evt_handler->m_stack.reserve(capacity);
315 _resize_locations(num_source_lines);
329 Callbacks const&
callbacks()
const { _RYML_ASSERT_BASIC(m_evt_handler);
return m_evt_handler->m_stack.m_callbacks; }
427 bool _scan_scalar_plain_blck(ScannedScalar *C4_RESTRICT sc,
size_t indentation);
428 bool _scan_scalar_plain_seq_flow(ScannedScalar *C4_RESTRICT sc);
429 bool _scan_scalar_plain_seq_blck(ScannedScalar *C4_RESTRICT sc);
430 bool _scan_scalar_plain_map_flow(ScannedScalar *C4_RESTRICT sc);
431 bool _scan_scalar_plain_map_blck(ScannedScalar *C4_RESTRICT sc);
432 bool _scan_scalar_map_json(ScannedScalar *C4_RESTRICT sc);
433 bool _scan_scalar_seq_json(ScannedScalar *C4_RESTRICT sc);
434 bool _scan_scalar_plain_unk(ScannedScalar *C4_RESTRICT sc);
435 bool _is_valid_start_scalar_plain_flow(
csubstr s);
436 bool _is_valid_start_scalar_plain_flow_check_block_token(
csubstr s);
437 bool _is_valid_start_scalar_plain_flow_check_qmrk(
csubstr s);
438 bool _scan_scalar_plain_handle_newline(
csubstr s,
size_t offs);
439 void _check_valid_newline_in_quoted_scalar();
441 ScannedScalar _scan_scalar_squot();
442 ScannedScalar _scan_scalar_dquot();
444 void _scan_block(ScannedBlock *C4_RESTRICT sb,
size_t indref);
457 csubstr _filter_scalar_literal(
substr s,
size_t indentation, BlockChomp_e chomp);
458 csubstr _filter_scalar_folded(
substr s,
size_t indentation, BlockChomp_e chomp);
461 csubstr _maybe_filter_key_scalar_plain(ScannedScalar
const& sc,
size_t indendation);
462 csubstr _maybe_filter_val_scalar_plain(ScannedScalar
const& sc,
size_t indendation);
463 csubstr _maybe_filter_key_scalar_squot(ScannedScalar
const& sc);
464 csubstr _maybe_filter_val_scalar_squot(ScannedScalar
const& sc);
465 csubstr _maybe_filter_key_scalar_dquot(ScannedScalar
const& sc);
466 csubstr _maybe_filter_val_scalar_dquot(ScannedScalar
const& sc);
467 csubstr _maybe_filter_key_scalar_literal(ScannedBlock
const& sb);
468 csubstr _maybe_filter_val_scalar_literal(ScannedBlock
const& sb);
469 csubstr _maybe_filter_key_scalar_folded(ScannedBlock
const& sb);
470 csubstr _maybe_filter_val_scalar_folded(ScannedBlock
const& sb);
475 void _handle_map_block();
476 bool _handle_map_block_qmrk();
477 bool _handle_map_block_rkcl();
478 void _handle_seq_block();
479 void _handle_map_flow();
480 void _handle_seq_flow();
481 void _handle_seq_imap();
482 void _handle_map_json();
483 void _handle_seq_json();
486 void _handle_unk_json();
490 void _handle_flow_skip_whitespace();
491 void _handle_flow_line_beginning();
493 size_t _handle_unk_check_left_tokens(
size_t realindent,
size_t col,
bool skip_annotations=
true);
494 void _handle_unk_get_first_non_pending_token_pos(
csubstr s,
size_t *indent,
size_t *first_non_token_pos);
495 void _handle_unk_begin_doc();
497 size_t _handle_block_skip_leading_whitespace();
499 size_t _handle_block_get_whitespace_mark() const noexcept {
return m_evt_handler->m_curr->pos.offset; }
500 void _handle_block_check_leading_tabs(
size_t prev_mark) {
return _handle_block_check_leading_tabs(prev_mark, m_evt_handler->m_curr->pos.offset); }
501 void _handle_block_check_leading_tabs(
size_t start_mark,
size_t end_mark);
503 void _end_map_flow();
504 void _end_seq_flow();
505 void _end_map_blck();
506 void _end_seq_blck();
509 void _end_flow_container(
size_t orig_indent,
bool multiline);
510 void _flow_container_was_a_key(
size_t orig_indent);
513 void _begin2_doc_expl();
515 void _end2_doc_expl();
516 void _check_doc_end_tokens()
const;
518 void _maybe_begin_doc();
519 void _maybe_end_doc();
521 void _start_doc_suddenly();
522 void _end_doc_suddenly();
523 void _end_doc_suddenly__pop();
524 void _check_trailing_doc_token();
527 void _set_indentation(
size_t indentation)
noexcept;
528 void _save_indentation();
529 void _mark_seqflow_val_end() noexcept;
530 void _handle_indentation_pop_from_block_seq();
531 void _handle_indentation_pop_from_block_map();
532 void _handle_indentation_pop(ParserState const* dst);
534 void _maybe_skip_comment();
535 void _maybe_skip_comment_strict();
536 void _skip_comment();
537 void _maybe_skip_whitespace_tokens();
538 void _maybe_skipchars(
char c);
540 void _skipchars(const
char (&chars)[N]);
541 bool _maybe_scan_following_colon() noexcept;
546 template<class FilterProcessor> auto _filter_plain(FilterProcessor &C4_RESTRICT proc,
size_t indentation) -> decltype(proc.result());
547 template<class FilterProcessor> auto _filter_squoted(FilterProcessor &C4_RESTRICT proc) -> decltype(proc.result());
548 template<class FilterProcessor> auto _filter_dquoted(FilterProcessor &C4_RESTRICT proc) -> decltype(proc.result());
549 template<class FilterProcessor> auto _filter_block_literal(FilterProcessor &C4_RESTRICT proc,
size_t indentation, BlockChomp_e chomp) -> decltype(proc.result());
550 template<class FilterProcessor> auto _filter_block_folded(FilterProcessor &C4_RESTRICT proc,
size_t indentation, BlockChomp_e chomp) -> decltype(proc.result());
556 template<class FilterProcessor>
void _filter_nl_plain(FilterProcessor &C4_RESTRICT proc,
size_t indentation);
557 template<class FilterProcessor>
void _filter_nl_squoted(FilterProcessor &C4_RESTRICT proc);
558 template<class FilterProcessor>
void _filter_nl_dquoted(FilterProcessor &C4_RESTRICT proc);
560 template<class FilterProcessor>
bool _filter_ws_handle_to_first_non_space(FilterProcessor &C4_RESTRICT proc);
561 template<class FilterProcessor>
void _filter_ws_copy_trailing(FilterProcessor &C4_RESTRICT proc);
562 template<class FilterProcessor>
void _filter_ws_skip_trailing(FilterProcessor &C4_RESTRICT proc);
564 template<class FilterProcessor>
void _filter_dquoted_backslash(FilterProcessor &C4_RESTRICT proc);
565 template<class FilterProcessor>
void _filter_dquoted_backslash_decode(FilterProcessor &C4_RESTRICT proc,
size_t sz);
567 template<class FilterProcessor>
void _filter_chomp(FilterProcessor &C4_RESTRICT proc, BlockChomp_e chomp,
size_t indentation);
568 template<class FilterProcessor>
size_t _handle_all_whitespace(FilterProcessor &C4_RESTRICT proc, BlockChomp_e chomp);
569 template<class FilterProcessor>
size_t _extend_to_chomp(FilterProcessor &C4_RESTRICT proc,
size_t contents_len);
570 template<class FilterProcessor>
void _filter_block_indentation(FilterProcessor &C4_RESTRICT proc,
size_t indentation);
571 template<class FilterProcessor>
void _filter_block_folded_newlines(FilterProcessor &C4_RESTRICT proc,
size_t indentation,
size_t len);
572 template<class FilterProcessor>
size_t _filter_block_folded_newlines_compress(FilterProcessor &C4_RESTRICT proc,
size_t num_newl,
size_t wpos_at_first_newl);
573 template<class FilterProcessor>
void _filter_block_folded_newlines_leading(FilterProcessor &C4_RESTRICT proc,
size_t indentation,
size_t len);
574 template<class FilterProcessor>
void _filter_block_folded_indented_block(FilterProcessor &C4_RESTRICT proc,
size_t indentation,
size_t len,
size_t curr_indentation) noexcept;
576 substr _alloc_arena(
size_t len,
substr *relocated=
nullptr);
577 substr _alloc_arena(
size_t len,
csubstr *relocated) {
return _alloc_arena(len,
reinterpret_cast<substr*
>(relocated)); }
583 void _line_progressed(
size_t ahead);
585 void _line_ended_undo();
587 bool _finished_file()
const;
588 bool _finished_line()
const;
591 substr _peek_next_line(
size_t pos=
npos)
const;
597 C4_ALWAYS_INLINE
substr _buf() const noexcept {
return m_evt_handler->m_src; }
599 C4_ALWAYS_INLINE
bool has_all(
ParserFlag_t f)
const noexcept {
return (m_evt_handler->m_curr->flags & f) == f; }
600 C4_ALWAYS_INLINE
bool has_any(
ParserFlag_t f)
const noexcept {
return (m_evt_handler->m_curr->flags & f) != 0; }
601 C4_ALWAYS_INLINE
bool has_none(
ParserFlag_t f)
const noexcept {
return (m_evt_handler->m_curr->flags & f) == 0; }
602 static C4_ALWAYS_INLINE
bool has_all(
ParserFlag_t f, ParserState
const* C4_RESTRICT s)
noexcept {
return (s->flags & f) == f; }
603 static C4_ALWAYS_INLINE
bool has_any(
ParserFlag_t f, ParserState
const* C4_RESTRICT s)
noexcept {
return (s->flags & f) != 0; }
604 static C4_ALWAYS_INLINE
bool has_none(
ParserFlag_t f, ParserState
const* C4_RESTRICT s)
noexcept {
return (s->flags & f) == 0; }
607 C4_ALWAYS_INLINE
void add_flags(
ParserFlag_t on)
noexcept { m_evt_handler->m_curr->flags |= on; }
608 C4_ALWAYS_INLINE
void addrem_flags(
ParserFlag_t on,
ParserFlag_t off)
noexcept { m_evt_handler->m_curr->flags &= ~off; m_evt_handler->m_curr->flags |= on; }
609 C4_ALWAYS_INLINE
void rem_flags(
ParserFlag_t off)
noexcept { m_evt_handler->m_curr->flags &= ~off; }
618 void _prepare_locations();
619 void _resize_locations(
size_t sz);
620 bool _locations_dirty()
const;
628 template<
class ...Args> C4_NORETURN C4_NO_INLINE
void _err(Location
const& cpploc,
const char *fmt, Args
const& ...args)
const;
629 template<
class ...Args> C4_NORETURN C4_NO_INLINE
void _err(Location
const& cpploc, Location
const& ymlloc,
const char *fmt, Args
const& ...args)
const;
631 template<
class ...Args> C4_NO_INLINE
void _dbg(
csubstr fmt, Args
const& ...args)
const;
632 template<
class DumpFn> C4_NO_INLINE
void _fmt_msg(DumpFn &&dumpfn)
const;
633 C4_NO_INLINE
void _print_state_stack()
const;
634 C4_NO_INLINE
void _print_state_stack(
substr buf)
const;
649 Entry annotations[2];
653 void _handle_colon();
654 void _add_annotation(Annotation *C4_RESTRICT dst,
csubstr str,
size_t indentation,
size_t line);
655 void _add_annotation(Annotation *C4_RESTRICT dst,
csubstr str,
size_t indentation,
size_t line,
csubstr orig);
656 void _add_annotation(Annotation *C4_RESTRICT dst,
csubstr str);
657 C4_ALWAYS_INLINE
void _clear_annotations(Annotation *C4_RESTRICT dst)
noexcept { dst->num_entries = 0; }
658 bool _annotations_require_key_container()
const;
659 bool _handle_annotations_before_unexpected_flow_token_rkey();
660 void _handle_annotations_before_blck_key_scalar();
661 void _handle_annotations_before_blck_val_scalar();
662 void _handle_annotations_before_start_mapblck(
size_t current_line);
663 void _handle_annotations_before_start_mapblck_as_key();
664 void _handle_annotations_and_indentation_after_start_mapblck(
size_t key_indentation,
size_t key_line);
665 size_t _select_indentation_from_annotations(
size_t val_indentation,
size_t val_line);
667 void _handle_keyref(
csubstr alias);
668 void _handle_valref(
csubstr alias);
670 void _handle_directive(
csubstr rem);
672 bool _validate_directive_tag(
csubstr *C4_RESTRICT directive,
csubstr *C4_RESTRICT handle,
csubstr *C4_RESTRICT prefix)
const;
683 EventHandler *C4_RESTRICT m_evt_handler;
688 Annotation m_pending_anchors;
689 Annotation m_pending_tags;
691 bool m_has_directives_yaml;
692 bool m_has_directives;
695 size_t m_prev_val_end;
705 size_t *m_newline_offsets;
706 size_t m_newline_offsets_size;
707 size_t m_newline_offsets_capacity;
714 RYML_DEPRECATED(
"filter arena no longer needed") size_t filter_arena_capacity()
const {
return 0u; }
715 RYML_DEPRECATED(
"filter arena no longer needed") void reserve_filter_arena(
size_t) {}
717 template<
class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_place(
csubstr filename,
substr yaml, Tree *t,
size_t node_id);
718 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_place(
substr yaml, Tree *t,
size_t node_id);
719 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_place(
csubstr filename,
substr yaml, Tree *t );
720 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_place(
substr yaml, Tree *t );
721 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_place(
csubstr filename,
substr yaml, NodeRef node );
722 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_place(
substr yaml, NodeRef node );
723 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree, Tree>::type
parse_in_place(
csubstr filename,
substr yaml );
724 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree, Tree>::type
parse_in_place(
substr yaml );
725 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_arena(
csubstr filename,
csubstr yaml, Tree *t,
size_t node_id);
726 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_arena(
csubstr yaml, Tree *t,
size_t node_id);
727 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_arena(
csubstr filename,
csubstr yaml, Tree *t );
728 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_arena(
csubstr yaml, Tree *t );
729 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_arena(
csubstr filename,
csubstr yaml, NodeRef node );
730 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_arena(
csubstr yaml, NodeRef node );
731 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree, Tree>::type
parse_in_arena(
csubstr filename,
csubstr yaml );
732 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the function in parse.hpp.") typename std::enable_if<U::is_wtree, Tree>::type
parse_in_arena(
csubstr yaml );
733 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the csubstr version in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_arena(
csubstr filename,
substr yaml, Tree *t,
size_t node_id);
734 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the csubstr version in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_arena(
substr yaml, Tree *t,
size_t node_id);
735 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the csubstr version in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_arena(
csubstr filename,
substr yaml, Tree *t );
736 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the csubstr version in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_arena(
substr yaml, Tree *t );
737 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the csubstr version in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_arena(
csubstr filename,
substr yaml, NodeRef node );
738 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the csubstr version in parse.hpp.") typename std::enable_if<U::is_wtree,
void>::type
parse_in_arena(
substr yaml, NodeRef node );
739 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the csubstr version in parse.hpp.") typename std::enable_if<U::is_wtree, Tree>::type
parse_in_arena(
csubstr filename,
substr yaml );
740 template<class U=EventHandler> RYML_DEPRECATED(
"removed, deliberately undefined. use the csubstr version in parse.hpp.") typename std::enable_if<U::is_wtree, Tree>::type
parse_in_arena(
substr yaml );
743 RYML_DEPRECATED(
"moved to Tree::location(Parser const&). deliberately undefined here.")
744 auto location(Tree const&,
id_type node) const -> typename std::enable_if<U::is_wtree, Location>::type;
747 RYML_DEPRECATED(
"moved to ConstNodeRef::location(Parser const&), deliberately undefined here.")
748 auto location(ConstNodeRef const&) const -> typename std::enable_if<U::is_wtree, Location>::type;