Helper to format a code point as a readable string
| 128 | |
| 129 | // Helper to format a code point as a readable string |
| 130 | static std::string format_codepoint(uint32_t cp) { |
| 131 | if (cp >= 32 && cp < 127) { |
| 132 | return std::string("'") + static_cast<char>(cp) + "'"; |
| 133 | } else if (cp == '\n') { |
| 134 | return "'\\n'"; |
| 135 | } else if (cp == '\r') { |
| 136 | return "'\\r'"; |
| 137 | } else if (cp == '\t') { |
| 138 | return "'\\t'"; |
| 139 | } else { |
| 140 | return "U+" + std::to_string(cp); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | // Helper to format expected element from grammar stack |
| 145 | static std::string format_expected_element(const llama_grammar_rules & /* rules*/, const llama_grammar_element * elem) { |
no test coverage detected