MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / try_consume_literal

Method try_consume_literal

subprojects/llama.cpp/common/chat-parser.cpp:242–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242bool common_chat_msg_parser::try_consume_literal(const std::string & literal) {
243 auto pos = pos_;
244 for (auto i = 0u; i < literal.size(); ++i) {
245 if (pos >= input_.size()) {
246 return false;
247 }
248 if (input_[pos] != literal[i]) {
249 return false;
250 }
251 ++pos;
252 }
253 pos_ = pos;
254 return true;
255}
256
257std::optional<common_chat_msg_parser::find_regex_result> common_chat_msg_parser::try_find_literal(const std::string & literal) {
258 auto idx = input_.find(literal, pos_);

Callers 5

test_regexFunction · 0.80

Calls 1

sizeMethod · 0.65

Tested by 1

test_regexFunction · 0.64