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

Method getValue

ext/src/llvm/YAMLParser.cpp:1883–1914  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1881}
1882
1883StringRef ScalarNode::getValue(SmallVectorImpl<char> &Storage) const {
1884 // TODO: Handle newlines properly. We need to remove leading whitespace.
1885 if (Value[0] == '"') { // Double quoted.
1886 // Pull off the leading and trailing "s.
1887 StringRef UnquotedValue = Value.substr(1, Value.size() - 2);
1888 // Search for characters that would require unescaping the value.
1889 StringRef::size_type i = UnquotedValue.find_first_of("\\\r\n");
1890 if (i != StringRef::npos)
1891 return unescapeDoubleQuoted(UnquotedValue, i, Storage);
1892 return UnquotedValue;
1893 } else if (Value[0] == '\'') { // Single quoted.
1894 // Pull off the leading and trailing 's.
1895 StringRef UnquotedValue = Value.substr(1, Value.size() - 2);
1896 StringRef::size_type i = UnquotedValue.find('\'');
1897 if (i != StringRef::npos) {
1898 // We're going to need Storage.
1899 Storage.clear();
1900 Storage.reserve(UnquotedValue.size());
1901 for (; i != StringRef::npos; i = UnquotedValue.find('\'')) {
1902 StringRef Valid(UnquotedValue.begin(), i);
1903 Storage.insert(Storage.end(), Valid.begin(), Valid.end());
1904 Storage.push_back('\'');
1905 UnquotedValue = UnquotedValue.substr(i + 2);
1906 }
1907 Storage.insert(Storage.end(), UnquotedValue.begin(), UnquotedValue.end());
1908 return StringRef(Storage.begin(), Storage.size());
1909 }
1910 return UnquotedValue;
1911 }
1912 // Plain or block.
1913 return Value.rtrim(' ');
1914}
1915
1916StringRef ScalarNode::unescapeDoubleQuoted( StringRef UnquotedValue
1917 , StringRef::size_type i

Callers 4

FindInEnvPathMethod · 0.45
createHNodesMethod · 0.45
writeMethod · 0.45
raw_ostream.cppFile · 0.45

Calls 14

rtrimMethod · 0.80
StringRefClass · 0.70
failedFunction · 0.50
substrMethod · 0.45
sizeMethod · 0.45
find_first_ofMethod · 0.45
findMethod · 0.45
clearMethod · 0.45
reserveMethod · 0.45
beginMethod · 0.45
insertMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected