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

Function has_export_macro_candidates

internal/cbm/preprocessor.cpp:219–253  ·  view source on GitHub ↗

Count-only scan used by the early gate (no storage).

Source from the content-addressed store, hash-verified

217
218// Count-only scan used by the early gate (no storage).
219static bool has_export_macro_candidates(const char *source, int source_len) {
220 if (!source || source_len <= 0) {
221 return false;
222 }
223 int i = 0;
224 while (i < source_len) {
225 i = skip_non_code(source, source_len, i);
226 if (i >= source_len) {
227 break;
228 }
229 if (!is_identifier_start(source[i])) {
230 i++;
231 continue;
232 }
233 int start = i;
234 while (i < source_len && is_identifier_char(source[i])) {
235 i++;
236 }
237 // A raw-string prefix consumes everything up to its closing quote;
238 // an unrecognizable raw form poisons the scan state, so fail toward
239 // NOT running the second pass (raw behavior preserved).
240 int raw = raw_string_after_prefix(source, source_len, start, i);
241 if (raw < 0) {
242 return false;
243 }
244 if (raw > 0) {
245 i = raw;
246 continue;
247 }
248 if (is_export_macro_shape(source + start, (size_t)(i - start))) {
249 return true;
250 }
251 }
252 return false;
253}
254
255static int collect_export_macro_candidates(const char *source, int source_len,
256 char (*out)[CBM_EXPORT_MACRO_NAME_MAX], int max_out) {

Callers 1

cbm_preprocess_with_mapFunction · 0.85

Calls 5

skip_non_codeFunction · 0.85
is_identifier_startFunction · 0.85
is_identifier_charFunction · 0.85
raw_string_after_prefixFunction · 0.85
is_export_macro_shapeFunction · 0.85

Tested by

no test coverage detected