MCPcopy Create free account
hub / github.com/ablab/spades / getVerbatimTag

Method getVerbatimTag

ext/src/llvm/YAMLParser.cpp:1814–1857  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1812}
1813
1814std::string Node::getVerbatimTag() const {
1815 StringRef Raw = getRawTag();
1816 if (!Raw.empty() && Raw != "!") {
1817 std::string Ret;
1818 if (Raw.find_last_of('!') == 0) {
1819 Ret = std::string(Doc->getTagMap().find("!")->second);
1820 Ret += Raw.substr(1);
1821 return Ret;
1822 } else if (Raw.startswith("!!")) {
1823 Ret = std::string(Doc->getTagMap().find("!!")->second);
1824 Ret += Raw.substr(2);
1825 return Ret;
1826 } else {
1827 StringRef TagHandle = Raw.substr(0, Raw.find_last_of('!') + 1);
1828 std::map<StringRef, StringRef>::const_iterator It =
1829 Doc->getTagMap().find(TagHandle);
1830 if (It != Doc->getTagMap().end())
1831 Ret = std::string(It->second);
1832 else {
1833 Token T;
1834 T.Kind = Token::TK_Tag;
1835 T.Range = TagHandle;
1836 setError(Twine("Unknown tag handle ") + TagHandle, T);
1837 }
1838 Ret += Raw.substr(Raw.find_last_of('!') + 1);
1839 return Ret;
1840 }
1841 }
1842
1843 switch (getType()) {
1844 case NK_Null:
1845 return "tag:yaml.org,2002:null";
1846 case NK_Scalar:
1847 case NK_BlockScalar:
1848 // TODO: Tag resolution.
1849 return "tag:yaml.org,2002:str";
1850 case NK_Mapping:
1851 return "tag:yaml.org,2002:map";
1852 case NK_Sequence:
1853 return "tag:yaml.org,2002:seq";
1854 }
1855
1856 return "";
1857}
1858
1859Token &Node::peekNext() {
1860 return Doc->peekNext();

Callers 2

mapTagMethod · 0.80
scalarTagMethod · 0.80

Calls 7

startswithMethod · 0.80
TwineClass · 0.50
emptyMethod · 0.45
find_last_ofMethod · 0.45
findMethod · 0.45
substrMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected