Scans [start, end) for the next occurrence of `needle` that is not inside * a `//` line comment, a nesting-aware slash-star block comment, or a "..." * string literal (backslash-escapes honored). This is the single source of * truth for "real code" scanning below — a `.target(`, `name:`, or `path:` * spelled inside a comment or a string constant must never be mistaken for * a live declaration
| 764 | * spelled inside a comment or a string constant must never be mistaken for |
| 765 | * a live declaration. Returns a pointer to the match, or NULL. */ |
| 766 | static const char *swift_find_code_token(const char *start, const char *end, const char *needle) { |
| 767 | size_t nlen = strlen(needle); |
| 768 | int block_depth = 0; |
| 769 | bool in_str = false; |
| 770 | const char *p = start; |
| 771 | while (p < end) { |
| 772 | if (swift_skip_comment_or_string(&p, end, &block_depth, &in_str)) { |
| 773 | continue; |
| 774 | } |
| 775 | if ((size_t)(end - p) >= nlen && memcmp(p, needle, nlen) == 0) { |
| 776 | return p; |
| 777 | } |
| 778 | p++; |
| 779 | } |
| 780 | return NULL; |
| 781 | } |
| 782 | |
| 783 | /* Find the matching ')' for the '(' at `open`, scanning forward to `end`. |
| 784 | * Delegates comment/string spans to swift_skip_comment_or_string — matching |
no test coverage detected