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

Function tokens_source_adjacent

internal/cbm/preprocessor.cpp:388–397  ·  view source on GitHub ↗

True when `prev` and `tok` touched in the source text: same file and line, `prev` ending exactly where `tok` starts (simplecpp's own adjacency test), and neither produced by a macro expansion (expansion tokens carry the call site's location, so their columns prove nothing).

Source from the content-addressed store, hash-verified

386// and neither produced by a macro expansion (expansion tokens carry the call
387// site's location, so their columns prove nothing).
388static bool tokens_source_adjacent(const simplecpp::Token *prev, const simplecpp::Token *tok) {
389 if (!prev->macro.empty() || !tok->macro.empty() || !prev->location.sameline(tok->location)) {
390 return false;
391 }
392 const std::string &s = prev->str();
393 if (s.find_first_of("\r\n") != std::string::npos) {
394 return false;
395 }
396 return prev->location.col + s.size() == tok->location.col;
397}
398
399// The expanded buffer in the source's own spelling. Mirrors
400// simplecpp::TokenList::stringify() line for line — the same newlines and

Callers 1

stringify_source_spacingFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected