MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / loadBuffer

Method loadBuffer

tests/catch.hpp:10280–10320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10278 std::vector<Token> m_tokenBuffer;
10279
10280 void loadBuffer()
10281 {
10282 m_tokenBuffer.resize(0);
10283
10284 // Skip any empty strings
10285 while (it != itEnd && it->empty())
10286 ++it;
10287
10288 if (it != itEnd) {
10289 auto const &next = *it;
10290 if (isOptPrefix(next[0])) {
10291 auto delimiterPos = next.find_first_of(" :=");
10292 if (delimiterPos != std::string::npos) {
10293 m_tokenBuffer.push_back(
10294 {TokenType::Option,
10295 next.substr(0, delimiterPos)});
10296 m_tokenBuffer.push_back(
10297 {TokenType::Argument,
10298 next.substr(delimiterPos + 1)});
10299 } else {
10300 if (next[1] != '-' && next.size() > 2) {
10301 std::string opt = "- ";
10302 for (size_t i = 1;
10303 i < next.size(); ++i) {
10304 opt[1] = next[i];
10305 m_tokenBuffer.push_back(
10306 {TokenType::Option,
10307 opt});
10308 }
10309 } else {
10310 m_tokenBuffer.push_back(
10311 {TokenType::Option,
10312 next});
10313 }
10314 }
10315 } else {
10316 m_tokenBuffer.push_back(
10317 {TokenType::Argument, next});
10318 }
10319 }
10320 }
10321
10322public:
10323 explicit TokenStream(Args const &args)

Callers

nothing calls this directly

Calls 4

isOptPrefixFunction · 0.85
substrMethod · 0.80
sizeMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected