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

Function php_name_text

internal/cbm/doclink_php.c:411–430  ·  view source on GitHub ↗

A name node's text without white space (`A \ B` is `A\B`), in the arena. */

Source from the content-addressed store, hash-verified

409
410/* A name node's text without white space (`A \ B` is `A\B`), in the arena. */
411static const char *php_name_text(php_walk_t *w, TSNode n, size_t *len) {
412 uint32_t b = ts_node_start_byte(n);
413 uint32_t e = ts_node_end_byte(n);
414 char *out = (char *)cbm_arena_alloc(w->sb->a, (size_t)(e - b) + SKIP_ONE);
415 if (!out) {
416 w->sb->oom = true;
417 *len = 0;
418 return "";
419 }
420 size_t k = 0;
421 for (uint32_t i = b; i < e; i++) {
422 char c = w->ctx->source[i];
423 if (!isspace((unsigned char)c)) {
424 out[k++] = c;
425 }
426 }
427 out[k] = '\0';
428 *len = k;
429 return out;
430}
431
432/* All named children of a node, read with one cursor walk (indexing them is
433 * quadratic). */

Callers 6

php_use_clauseFunction · 0.85
php_use_declFunction · 0.85
php_decl_nameFunction · 0.85
php_baseFunction · 0.85
php_memberFunction · 0.85
php_namespace_recFunction · 0.85

Calls 1

cbm_arena_allocFunction · 0.70

Tested by

no test coverage detected