A written path (`a::b::C`, `crate::x`, `::std::fmt`) of the node's text, * whitespace removed: copied into `out` when it holds nothing but segments. * false for a type that is no path (a reference, a tuple, generics inside). */
| 2245 | * whitespace removed: copied into `out` when it holds nothing but segments. |
| 2246 | * false for a type that is no path (a reference, a tuple, generics inside). */ |
| 2247 | static bool rs_path_of(const rs_scan_t *s, TSNode n, char *out, size_t cap) { |
| 2248 | if (ts_node_is_null(n)) { |
| 2249 | return false; |
| 2250 | } |
| 2251 | uint32_t a = ts_node_start_byte(n); |
| 2252 | uint32_t b = ts_node_end_byte(n); |
| 2253 | if (b <= a || b > s->src_len) { |
| 2254 | return false; |
| 2255 | } |
| 2256 | size_t w = 0; |
| 2257 | for (uint32_t i = a; i < b; i++) { |
| 2258 | char c = s->src[i]; |
| 2259 | if (isspace((unsigned char)c)) { |
| 2260 | continue; |
| 2261 | } |
| 2262 | if (w + SKIP_ONE >= cap) { |
| 2263 | return false; |
| 2264 | } |
| 2265 | out[w++] = c; |
| 2266 | } |
| 2267 | out[w] = '\0'; |
| 2268 | CBMDocLinkRsPath path; |
| 2269 | return w > 0 && !memchr(out, '<', w) && !memchr(out, '@', w) && !memchr(out, '!', w) && |
| 2270 | !memchr(out, '(', w) && |
| 2271 | cbm_doclink_rs_parse_path(out, w, false, &path) == CBM_DOCLINK_RS_PATH_OK; |
| 2272 | } |
| 2273 | |
| 2274 | /* ── Scope scan: definitions ─────────────────────────────────────── */ |
| 2275 |
no test coverage detected