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. */
| 3497 | * does not know yet parses this way; the items around the function are then |
| 3498 | * exactly where the tree puts them. */ |
| 3499 | static 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 |
no test coverage detected