MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / visit

Method visit

common/chat-peg-parser.cpp:970–1007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

968}
969
970void common_chat_peg_gemma4_mapper::visit(const common_peg_ast_arena & arena, common_peg_ast_id id) {
971 const auto & node = arena.get(id);
972
973 if (node.tag == "reasoning") {
974 result.reasoning_content += std::string(node.text);
975 return;
976 }
977
978 if (node.tag == "content") {
979 result.content += std::string(node.text);
980 return;
981 }
982
983 if (node.tag == "tool") {
984 auto name_id = arena.find_by_tag(node, "tool-name");
985 auto args_id = arena.find_by_tag(node, "tool-args");
986
987 if (name_id != COMMON_PEG_INVALID_AST_ID && args_id != COMMON_PEG_INVALID_AST_ID) {
988 const auto & name_node = arena.get(name_id);
989 const auto & args_node = arena.get(args_id);
990
991 if (!name_node.is_partial) {
992 common_chat_tool_call call;
993 call.name = std::string(name_node.text);
994 if (!args_node.children.empty()) {
995 call.arguments = gemma4_to_json(arena, args_node.children[0]);
996 }
997 result.tool_calls.push_back(call);
998 }
999 }
1000
1001 return;
1002 }
1003
1004 for (auto child_id : node.children) {
1005 visit(arena, child_id);
1006 }
1007}

Callers 1

from_astMethod · 0.45

Calls 6

stringClass · 0.85
gemma4_to_jsonFunction · 0.85
find_by_tagMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected