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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 400 additions and 38 deletions

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 = {