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

Function parse_pubspec_yaml

src/pipeline/pass_pkgmap.c:521–536  ·  view source on GitHub ↗

Dart: pubspec.yaml — name */

Source from the content-addressed store, hash-verified

519
520/* Dart: pubspec.yaml — name */
521static void parse_pubspec_yaml(const char *source, int source_len, const char *rel_path,
522 cbm_pkg_entries_t *entries) {
523 cbm_yaml_node_t *root = cbm_yaml_parse(source, source_len);
524 if (!root) {
525 return;
526 }
527 const char *name = cbm_yaml_get_str(root, "name");
528 if (name && name[0] != '\0') {
529 char *dir = path_dirname(rel_path);
530 char entry[PKGMAP_PATH_BUF];
531 snprintf(entry, sizeof(entry), "%s%slib", dir[0] ? dir : "", dir[0] ? "/" : "");
532 pkg_entries_push(entries, strdup(name), strdup(entry));
533 free(dir);
534 }
535 cbm_yaml_free(root);
536}
537
538/* Extract text content of an XML tag at position p. Returns heap string or NULL.
539 * 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