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

Function jv_java_ref_len

internal/cbm/doclink_jvm.c:335–357  ·  view source on GitHub ↗

Length of the Javadoc reference at s: a (qualified) type, `#member`, * `module/`, type arguments, array brackets and a parameter list. A parameter * list that does not close takes the rest (the reference is malformed, and * the resolver says so). */

Source from the content-addressed store, hash-verified

333 * list that does not close takes the rest (the reference is malformed, and
334 * the resolver says so). */
335static size_t jv_java_ref_len(const char *s, size_t n) {
336 size_t j = 0;
337 while (j < n) {
338 char c = s[j];
339 if (jv_ident_char(c) || c == '.' || c == '#' || c == '/') {
340 j++;
341 } else if (c == '<') {
342 size_t e = jv_group_end(s, n, j, '<', '>');
343 if (e >= n && (n == 0 || s[n - SKIP_ONE] != '>')) {
344 break;
345 }
346 j = e;
347 } else if (c == '[' && j + SKIP_ONE < n && s[j + SKIP_ONE] == ']') {
348 j += PAIR_LEN;
349 } else {
350 break;
351 }
352 }
353 if (j < n && s[j] == '(') {
354 j = jv_group_end(s, n, j, '(', ')');
355 }
356 return j;
357}
358
359/* The reference at s[0, n): what the doc tool reads as one reference. Text
360 * glued to it (`Foo,`, `http://x`) makes the whole word the (malformed)

Callers 1

jv_java_refFunction · 0.85

Calls 2

jv_ident_charFunction · 0.85
jv_group_endFunction · 0.85

Tested by

no test coverage detected