move cache stack to advance stack
This commit is contained in:
parent
cb1632b593
commit
901a3479b1
4 changed files with 39 additions and 36 deletions
|
@ -15,10 +15,11 @@ static bool llama_grammar_validate(struct llama_grammar * grammar, const std::st
|
|||
llama_grammar_stacks & stacks_cur = llama_grammar_get_stacks(grammar);
|
||||
|
||||
size_t pos = 0;
|
||||
llama_grammar_stacks_cache stacks_cache;
|
||||
for (const auto & cpt : cpts) {
|
||||
const llama_grammar_stacks stacks_prev = llama_grammar_get_stacks(grammar); // copy
|
||||
|
||||
llama_grammar_accept(rules, stacks_prev, cpt, stacks_cur);
|
||||
llama_grammar_accept(rules, stacks_prev, cpt, stacks_cur, stacks_cache);
|
||||
|
||||
if (stacks_cur.empty()) {
|
||||
error_pos = pos;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue