MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / tp_parse_sequence

Function tp_parse_sequence

src/mcp/test_impact_policy.c:254–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252}
253
254static tp_chain_t tp_parse_sequence(tp_expander_t *exp, unsigned depth, bool in_group) {
255 tp_chain_t result = {0};
256 size_t literal = exp->pos;
257 while (exp->pos < exp->len && exp->valid) {
258 char ch = exp->text[exp->pos];
259 if (ch == '\\' && exp->pos + 1 < exp->len) {
260 exp->pos += 2;
261 continue;
262 }
263 if (ch == '[') {
264 exp->pos = tp_class_end(exp->text, exp->len, exp->pos);
265 continue;
266 }
267 if (ch == '}' || (in_group && ch == ',')) {
268 if (!in_group)
269 exp->valid = false;
270 break;
271 }
272 if (ch == '{') {
273 if (exp->pos > literal)
274 tp_chain_literal(exp, &result, exp->text + literal, exp->pos - literal);
275 tp_chain_t group = tp_parse_group(exp, depth);
276 tp_chain_append(&result, group);
277 literal = exp->pos;
278 } else {
279 exp->pos++;
280 }
281 }
282 if (exp->valid && exp->pos > literal)
283 tp_chain_literal(exp, &result, exp->text + literal, exp->pos - literal);
284 return result;
285}
286
287static unsigned char tp_class_char(const char *text, size_t end, size_t *pos) {
288 if (text[*pos] == '\\' && *pos + 1 < end)

Callers 2

tp_parse_groupFunction · 0.85
tp_expand_patternFunction · 0.85

Calls 4

tp_class_endFunction · 0.85
tp_chain_literalFunction · 0.85
tp_parse_groupFunction · 0.85
tp_chain_appendFunction · 0.85

Tested by

no test coverage detected