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

Function join_kind

internal/cbm/doc_pdf.c:854–889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

852typedef enum { JK_NONE = 0, JK_SOFT, JK_HYPHEN, JK_CODE } join_kind_t;
853
854static join_kind_t join_kind(const uint32_t *prev, int pn, const uint32_t *nxt, int nn) {
855 if (!pn || !nn) {
856 return JK_NONE;
857 }
858 if (prev[pn - 1] == 0x00AD && pdf_u_alpha(nxt[0])) {
859 return JK_SOFT;
860 }
861 if (prev[pn - 1] == '-' && pn >= 2 && pdf_u_alpha(prev[pn - 2]) && pdf_u_lower(nxt[0])) {
862 return JK_HYPHEN;
863 }
864 static const char *const sufs[] = {"::", "->", "_", "/"};
865 for (int k = 0; k < 4; k++) {
866 int sl = (int)strlen(sufs[k]);
867 if (pn > sl && lit_at(prev, pn, pn - sl, sufs[k]) && idc(prev[pn - sl - 1]) &&
868 idc(nxt[0])) {
869 return JK_CODE;
870 }
871 }
872 if (idc(prev[pn - 1])) {
873 /* (?:\.|::|->|_)[A-Za-z_] | \(\) at the start of nxt */
874 int s = 0;
875 if (nxt[0] == '.' || nxt[0] == '_') {
876 s = 1;
877 } else if (nn >= 2 &&
878 ((nxt[0] == ':' && nxt[1] == ':') || (nxt[0] == '-' && nxt[1] == '>'))) {
879 s = 2;
880 }
881 if (s && s < nn && (is_alpha_ascii(nxt[s]) || nxt[s] == '_')) {
882 return JK_CODE;
883 }
884 if (nn >= 2 && nxt[0] == '(' && nxt[1] == ')') {
885 return JK_CODE;
886 }
887 }
888 return JK_NONE;
889}
890
891/* [A-Za-z0-9_$@.:/\-#>­] and [A-Za-z0-9_$@.:/\-#>()] */
892static bool left_run_char(uint32_t c) {

Callers 1

scan_pageFunction · 0.85

Calls 5

pdf_u_alphaFunction · 0.85
pdf_u_lowerFunction · 0.85
lit_atFunction · 0.85
idcFunction · 0.85
is_alpha_asciiFunction · 0.85

Tested by

no test coverage detected