MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / loadBuffer

Method loadBuffer

Bcore/src/main/cpp/Dobby/tests/catch.hpp:5440–5469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5438 std::vector<Token> m_tokenBuffer;
5439
5440 void loadBuffer() {
5441 m_tokenBuffer.resize(0);
5442
5443 // Skip any empty strings
5444 while (it != itEnd && it->empty())
5445 ++it;
5446
5447 if (it != itEnd) {
5448 auto const &next = *it;
5449 if (isOptPrefix(next[0])) {
5450 auto delimiterPos = next.find_first_of(" :=");
5451 if (delimiterPos != std::string::npos) {
5452 m_tokenBuffer.push_back({TokenType::Option, next.substr(0, delimiterPos)});
5453 m_tokenBuffer.push_back({TokenType::Argument, next.substr(delimiterPos + 1)});
5454 } else {
5455 if (next[1] != '-' && next.size() > 2) {
5456 std::string opt = "- ";
5457 for (size_t i = 1; i < next.size(); ++i) {
5458 opt[1] = next[i];
5459 m_tokenBuffer.push_back({TokenType::Option, opt});
5460 }
5461 } else {
5462 m_tokenBuffer.push_back({TokenType::Option, next});
5463 }
5464 }
5465 } else {
5466 m_tokenBuffer.push_back({TokenType::Argument, next});
5467 }
5468 }
5469 }
5470
5471public:
5472 explicit TokenStream(Args const &args) : TokenStream(args.m_args.begin(), args.m_args.end()) {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected