MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / main

Function main

tests/test-grammar-parser.cpp:142–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142int main()
143{
144 verify_failure(R"""(
145 root ::= "a"{,}"
146 )""");
147
148 verify_failure(R"""(
149 root ::= (((((([^x]*){0,99}){0,99}){0,99}){0,99}){0,99}){0,99}
150 )""");
151
152 verify_failure(R"""(
153 root ::= "a"{,10}"
154 )""");
155
156 verify_parsing(R"""(
157 root ::= "a"
158 )""", {
159 {"root", 0},
160 }, {
161 // root (index 0)
162 {LLAMA_GRETYPE_CHAR, 'a'},
163 {LLAMA_GRETYPE_END, 0},
164 });
165
166 verify_parsing(R"""(
167 root ::= "a" | [bdx-z] | [^1-3]
168 )""", {
169 {"root", 0},
170 }, {
171 // root (index 0)
172 {LLAMA_GRETYPE_CHAR, 'a'},
173 {LLAMA_GRETYPE_ALT, 0},
174 {LLAMA_GRETYPE_CHAR, 'b'},
175 {LLAMA_GRETYPE_CHAR_ALT, 'd'},
176 {LLAMA_GRETYPE_CHAR_ALT, 'x'},
177 {LLAMA_GRETYPE_CHAR_RNG_UPPER, 'z'},
178 {LLAMA_GRETYPE_ALT, 0},
179 {LLAMA_GRETYPE_CHAR_NOT, '1'},
180 {LLAMA_GRETYPE_CHAR_RNG_UPPER, '3'},
181 {LLAMA_GRETYPE_END, 0},
182 });
183
184 verify_parsing(R"""(
185 root ::= a+
186 a ::= "a"
187 )""", {
188 {"a", 1},
189 {"root", 0},
190 {"root_2", 2},
191 }, {
192 // root (index 0)
193 {LLAMA_GRETYPE_RULE_REF, /* a */ 1},
194 {LLAMA_GRETYPE_RULE_REF, /* root_2 */ 2},
195 {LLAMA_GRETYPE_END, 0},
196 // a (index 1)
197 {LLAMA_GRETYPE_CHAR, 'a'},
198 {LLAMA_GRETYPE_END, 0},
199 // root_2 (index 2)

Callers

nothing calls this directly

Calls 2

verify_failureFunction · 0.85
verify_parsingFunction · 0.85

Tested by

no test coverage detected