Append one source token: internal whitespace is dropped except as a single * space between two identifier characters, which is also the rule at the * boundary with what is already in the buffer. */
| 96 | * space between two identifier characters, which is also the rule at the |
| 97 | * boundary with what is already in the buffer. */ |
| 98 | static void sig_token(sig_ctx_t *c, const char *s, size_t n) { |
| 99 | bool pending_space = false; |
| 100 | for (size_t i = 0; i < n; i++) { |
| 101 | unsigned char ch = (unsigned char)s[i]; |
| 102 | if (isspace(ch)) { |
| 103 | pending_space = true; |
| 104 | continue; |
| 105 | } |
| 106 | bool first = c->len == 0 || c->buf[c->len - 1] == ' '; |
| 107 | if (!first && sig_ident_char((unsigned char)c->buf[c->len - 1]) && sig_ident_char(ch) && |
| 108 | (pending_space || i == 0)) { |
| 109 | sig_raw(c, " ", 1); |
| 110 | } |
| 111 | pending_space = false; |
| 112 | sig_raw(c, (const char *)&s[i], 1); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | static const char *sig_variadic_marker(CBMLanguage lang) { |
| 117 | return lang == CBM_LANG_JAVA ? "[]" : "~"; |
no test coverage detected