453 RYML_ASSERT_BASIC_CB_(callbacks, !buf.overlaps(tag));
454 TagDirective
const* C4_RESTRICT td =
lookup(tag,
id);
457 const char *errmsg =
nullptr;
466 _c4dbgp(
"tagd: no directive found");
467 if(tag.begins_with(
'<'))
469 _c4dbgp(
"tagd: already resolved");
470 if C4_UNLIKELY(!tag.ends_with(
'>'))
472 errmsg =
"malformed tag";
477 else if(tag.begins_with(
"!<"))
479 _c4dbgp(
"tagd: already resolved");
480 if C4_UNLIKELY(!tag.ends_with(
'>'))
482 errmsg =
"malformed tag";
487 else if(tag.begins_with(
"!!"))
493 _c4dbgpf(
"tagd: standard tag: {} -> {}", tag,
from_tag_long(tagenum));
495 return with_brackets ? tag : tag.offs(1, 1);
498 prefix =
"tag:yaml.org,2002:";
502 _c4dbgp(
"tagd: custom_tag");
503 _c4dbgpf(
"tag '{}' at id={}: no matching directive was found", tag,
id);
504 errmsg =
"tag without matching directive";
510 handle = prefix =
"!";
513 len =
transform_tag(buf, handle, prefix, tag, callbacks, ymlloc, with_brackets);
517 ret = buf.first(len);
521 _c4dbgp(
"tagd: not enough room");
529 RYML_ERR_PARSE_CB_(callbacks, ymlloc, errmsg);
533 RYML_ERR_BASIC_CB_(callbacks, errmsg);
size_t transform_tag(substr output, csubstr handle, csubstr prefix, csubstr tag, Callbacks const &callbacks, Location const &ymlloc, bool with_brackets)
returns the length of the transformed tag, or 0 to signal that the tag is local and cannot be resolve...
csubstr from_tag_long(YamlTag_e tag)
basic_substring< const char > csubstr
an immutable string view
YamlTag_e
a bit mask for marking tags for types
TagDirective const * lookup(csubstr tag, id_type id) const noexcept
bool is_custom_tag(csubstr tag)
is a tag of the form !handle!tag?
YamlTag_e to_tag(csubstr tag)