| 586 | } |
| 587 | |
| 588 | llama_grammar_stack llama_grammar_parser::c_rules() const { |
| 589 | llama_grammar_stack ret; |
| 590 | ret.reserve(rules.size()); |
| 591 | for (const auto & rule : rules) { |
| 592 | ret.push_back(rule.data()); |
| 593 | } |
| 594 | return ret; |
| 595 | } |
| 596 | |
| 597 | // returns true iff pos points to the end of one of the definitions of a rule |
| 598 | static bool llama_grammar_is_end_of_sequence(const llama_grammar_element * pos) { |