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

Method choice

subprojects/llama.cpp/common/peg-parser.cpp:979–991  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

977}
978
979common_peg_parser common_peg_parser_builder::choice(const std::vector<common_peg_parser_id> & parsers) {
980 // Flatten nested choices
981 std::vector<common_peg_parser_id> flattened;
982 for (const auto & p : parsers) {
983 const auto & parser = arena_.get(p);
984 if (auto choice = std::get_if<common_peg_choice_parser>(&parser)) {
985 flattened.insert(flattened.end(), choice->children.begin(), choice->children.end());
986 } else {
987 flattened.push_back(p);
988 }
989 }
990 return wrap(arena_.add_parser(common_peg_choice_parser{flattened}));
991}
992
993common_peg_parser common_peg_parser_builder::choice(const std::vector<common_peg_parser> & parsers) {
994 std::vector<common_peg_parser_id> ids;

Callers 10

test_example_nativeFunction · 0.45
test_example_qwen3_coderFunction · 0.45
generator_random_charsFunction · 0.45
peg-parser.cppFile · 0.45
operator|Method · 0.45

Calls 8

add_parserMethod · 0.80
getMethod · 0.65
sizeMethod · 0.65
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
push_backMethod · 0.45
idMethod · 0.45

Tested by 5

test_example_nativeFunction · 0.36
test_example_qwen3_coderFunction · 0.36
generator_random_charsFunction · 0.36