| 585 | } |
| 586 | |
| 587 | static bool is_camel(const uint32_t *t, int n) { |
| 588 | if (n < 3 || str_isupper(t, n) || str_islower(t, n)) { |
| 589 | return false; |
| 590 | } |
| 591 | /* [A-Z]{2,}s: PDFs, APIs, IDs */ |
| 592 | if (t[n - 1] == 's') { |
| 593 | bool caps = true; |
| 594 | for (int i = 0; i < n - 1; i++) { |
| 595 | caps = caps && t[i] >= 'A' && t[i] <= 'Z'; |
| 596 | } |
| 597 | if (caps) { |
| 598 | return false; |
| 599 | } |
| 600 | } |
| 601 | for (int i = 0; i + 1 < n; i++) { |
| 602 | uint32_t a = t[i]; |
| 603 | uint32_t b = t[i + 1]; |
| 604 | if (pdf_u_lower(a) && pdf_u_upper(b)) { |
| 605 | return true; |
| 606 | } |
| 607 | if (i >= 1 && pdf_u_upper(t[i - 1]) && pdf_u_upper(a) && pdf_u_lower(b)) { |
| 608 | return true; |
| 609 | } |
| 610 | } |
| 611 | return false; |
| 612 | } |
| 613 | |
| 614 | /* The extension after the last '.' of a segment, when it is a code extension. */ |
| 615 | static bool has_code_ext(const uint32_t *s, int n) { |
no test coverage detected