llama : add token matching support to llama-grammar (#17816)

* llama : add token support to llama-grammar

* fix inverse token comment

* refactor trigger_patterns to replay tokens instead of the entire string

* add token documentation

* fix test-llama-grammar

* improve test cases for tokens
This commit is contained in:
Aldehir Rojas
2025-12-09 00:32:57 -06:00
committed by GitHub
parent 1d2a1ab73d
commit e39502e74b
6 changed files with 400 additions and 38 deletions
+1 -1
View File
@@ -202,7 +202,7 @@ int main()
uint32_t *cp = new uint32_t[2]; // dynamically allocate memory for code_point
cp[0] = 37 + i;
cp[1] = 0;
next_candidates[i] = {i, cp, {}};
next_candidates[i] = {i, cp, {}, 0};
}
std::vector<std::vector<std::pair<uint32_t, uint16_t>>> expected_reject = {