| 114 | } |
| 115 | |
| 116 | static std::unique_ptr<llama_grammar> build_grammar(const std::string & grammar_str) { |
| 117 | return std::unique_ptr<llama_grammar>( |
| 118 | llama_grammar_init_impl(nullptr, grammar_str.c_str(), "root", false, nullptr, 0, nullptr, 0)); |
| 119 | } |
| 120 | |
| 121 | // TODO: extract to common helper (copied from test-grammar-integration.cpp) |
| 122 | static bool match_string(const std::string & input, llama_grammar * grammar) { |
no test coverage detected