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

Function rs_error_contained

internal/cbm/doclink_rs.c:3499–3510  ·  view source on GitHub ↗

An error node that cannot have moved an item boundary: it lies inside a * block (a function body: nothing in there is scanned), and the parser * neither skipped unpaired delimiters nor made one up. Syntax the grammar * does not know yet parses this way; the items around the function are then * exactly where the tree puts them. */

Source from the content-addressed store, hash-verified

3497 * does not know yet parses this way; the items around the function are then
3498 * exactly where the tree puts them. */
3499static bool rs_error_contained(const rs_scan_t *s, TSNode n, bool in_block) {
3500 uint32_t a = ts_node_start_byte(n);
3501 uint32_t b = ts_node_end_byte(n);
3502 if (!in_block || b > s->src_len) {
3503 return false;
3504 }
3505 if (ts_node_is_missing(n)) {
3506 const char *t = ts_node_type(n);
3507 return !rs_delimiter(t, true) && !rs_delimiter(t, false);
3508 }
3509 return b <= a || rs_delims_balanced(s->src + a, b - a);
3510}
3511
3512/* The first ERROR or MISSING node of the tree, in document order, that is not
3513 * contained (rs_error_contained); a null node when there is none. Walks only

Callers 1

rs_first_errorFunction · 0.85

Calls 2

rs_delimiterFunction · 0.85
rs_delims_balancedFunction · 0.85

Tested by

no test coverage detected