Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/llama-grammar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ const char * llama_grammar_parser::parse_sequence(
// (though it's technically the same as -1 now)
auto handle_repetitions = [&](uint64_t min_times, uint64_t max_times) {
bool no_max = max_times == UINT64_MAX;
if (!no_max && max_times < min_times) {
throw std::runtime_error("invalid repetition range: max < min");
}
if (last_sym_start == rule.size()) {
throw std::runtime_error(std::string("expecting preceding item to */+/?/{ at ") + pos);
}
Expand Down