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

Function rs_inline_angle

internal/cbm/doclink_rs.c:1861–1895  ·  view source on GitHub ↗

Past the autolink or HTML construct at s[i] == '<', or i + 1 when it is * neither. */

Source from the content-addressed store, hash-verified

1859/* Past the autolink or HTML construct at s[i] == '<', or i + 1 when it is
1860 * neither. */
1861static uint32_t rs_inline_angle(rs_inline_t *in, uint32_t i) {
1862 const char *p = in->s + i;
1863 uint32_t n = in->n - i;
1864 if (n < PAIR_LEN) {
1865 return i + SKIP_ONE;
1866 }
1867 bool is_raw = false;
1868 uint32_t raw_end = rs_inline_raw_html(in, i, &is_raw);
1869 if (is_raw) {
1870 return raw_end ? raw_end : i + SKIP_ONE;
1871 }
1872 char c = p[1];
1873 if (!(isalpha((unsigned char)c) || c == '/' || c == '!')) {
1874 return i + SKIP_ONE;
1875 }
1876 uint32_t end = rs_html_tag_end(p, n);
1877 if (end == 0) {
1878 return i + SKIP_ONE;
1879 }
1880 if (isalpha((unsigned char)c)) {
1881 /* `<name ...>` is a tag; `<scheme:...>` and `<a@b>` are autolinks; text
1882 * with a space before any of that is neither */
1883 uint32_t k = SKIP_ONE;
1884 while (k < end &&
1885 (isalnum((unsigned char)p[k]) || p[k] == '-' || p[k] == '+' || p[k] == '.')) {
1886 k++;
1887 }
1888 bool tag = p[k] == '>' || p[k] == ' ' || p[k] == '\t' || p[k] == '\n' || p[k] == '/';
1889 bool autolink = (p[k] == ':' || p[k] == '@') && !memchr(p, ' ', end);
1890 if (!tag && !autolink) {
1891 return i + SKIP_ONE;
1892 }
1893 }
1894 return i + end;
1895}
1896
1897/* The inline link `(dest "title")` at s[i] == '('. On success *end is past the
1898 * closing parenthesis. */

Callers 1

rs_inline_scanFunction · 0.85

Calls 2

rs_inline_raw_htmlFunction · 0.85
rs_html_tag_endFunction · 0.85

Tested by

no test coverage detected