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

Function parse_pubspec_yaml

src/pipeline/pass_pkgmap.c:503–518  ·  view source on GitHub ↗

Dart: pubspec.yaml — name */

Source from the content-addressed store, hash-verified

501
502/* Dart: pubspec.yaml — name */
503static void parse_pubspec_yaml(const char *source, int source_len, const char *rel_path,
504 cbm_pkg_entries_t *entries) {
505 cbm_yaml_node_t *root = cbm_yaml_parse(source, source_len);
506 if (!root) {
507 return;
508 }
509 const char *name = cbm_yaml_get_str(root, "name");
510 if (name && name[0] != '\0') {
511 char *dir = path_dirname(rel_path);
512 char entry[PKGMAP_PATH_BUF];
513 snprintf(entry, sizeof(entry), "%s%slib", dir[0] ? dir : "", dir[0] ? "/" : "");
514 pkg_entries_push(entries, strdup(name), strdup(entry));
515 free(dir);
516 }
517 cbm_yaml_free(root);
518}
519
520/* Extract text content of an XML tag at position p. Returns heap string or NULL.
521 * p must point to the char after the opening tag's '>'. */

Callers 1

cbm_pkgmap_try_parseFunction · 0.85

Calls 5

cbm_yaml_parseFunction · 0.85
cbm_yaml_get_strFunction · 0.85
path_dirnameFunction · 0.85
pkg_entries_pushFunction · 0.85
cbm_yaml_freeFunction · 0.85

Tested by

no test coverage detected