Past a string / rune literal or a comment starting at p; p when none. */
| 1055 | |
| 1056 | /* Past a string / rune literal or a comment starting at p; p when none. */ |
| 1057 | static const char *gc_skip(const char *p) { |
| 1058 | if (*p == '"' || *p == '\'') { |
| 1059 | char q = *p++; |
| 1060 | while (*p && *p != q && *p != '\n') { |
| 1061 | p += (*p == '\\' && p[SKIP_ONE]) ? PAIR_LEN : SKIP_ONE; |
| 1062 | } |
| 1063 | return *p == q ? p + SKIP_ONE : p; |
| 1064 | } |
| 1065 | if (*p == '`') { |
| 1066 | const char *e = strchr(p + SKIP_ONE, '`'); |
| 1067 | return e ? e + SKIP_ONE : p + strlen(p); |
| 1068 | } |
| 1069 | if (p[0] == '/' && p[SKIP_ONE] == '/') { |
| 1070 | const char *e = strchr(p, '\n'); |
| 1071 | return e ? e : p + strlen(p); |
| 1072 | } |
| 1073 | if (p[0] == '/' && p[SKIP_ONE] == '*') { |
| 1074 | const char *e = strstr(p + PAIR_LEN, "*/"); |
| 1075 | return e ? e + PAIR_LEN : p + strlen(p); |
| 1076 | } |
| 1077 | return p; |
| 1078 | } |
| 1079 | |
| 1080 | /* The '}' closing the block opened at `open`. */ |
| 1081 | static const char *gc_block_end(const char *open) { |
no outgoing calls
no test coverage detected