451 _RYML_ASSERT_BASIC_(callbacks, !buf.overlaps(tag));
452 TagDirective
const* C4_RESTRICT td =
lookup(tag,
id);
454 csubstr handle, prefix, ret;
455 const char *errmsg =
nullptr;
464 _c4dbgp(
"tagd: no directive found");
465 if(tag.begins_with(
'<'))
467 _c4dbgp(
"tagd: already resolved");
468 if(C4_UNLIKELY(!tag.ends_with(
'>')))
470 errmsg =
"malformed tag";
475 else if(tag.begins_with(
"!<"))
477 _c4dbgp(
"tagd: already resolved");
478 if(C4_UNLIKELY(!tag.ends_with(
'>')))
480 errmsg =
"malformed tag";
485 else if(tag.begins_with(
"!!"))
491 _c4dbgpf(
"tagd: standard tag: {} -> {}", tag,
from_tag_long(tagenum));
493 return with_brackets ? tag : tag.offs(1, 1);
496 prefix =
"tag:yaml.org,2002:";
500 _c4dbgp(
"tagd: custom_tag");
501 _c4dbgpf(
"tag '{}' at id={}: no matching directive was found", tag,
id);
502 errmsg =
"tag without matching directive";
508 handle = prefix =
"!";
511 len =
transform_tag(buf, handle, prefix, tag, callbacks, ymlloc, with_brackets);
515 ret = buf.first(len);
519 _c4dbgp(
"tagd: not enough room");
527 _RYML_ERR_PARSE_(callbacks, ymlloc, errmsg);
531 _RYML_ERR_BASIC_(callbacks, errmsg);
csubstr from_tag_long(YamlTag_e tag)
YamlTag_e
a bit mask for marking tags for types
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...
YamlTag_e to_tag(csubstr tag)
TagDirective const * lookup(csubstr tag, id_type id) const noexcept