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

Function tdx_directive_end

internal/cbm/extract_defs.c:6114–6168  ·  view source on GitHub ↗

Bound a directive only after complete comments/literals, not at a physical * newline inside a block comment. The audit view already has line splices * removed. This locates its extent; tdx_directive validates consumed content. */

Source from the content-addressed store, hash-verified

6112 * newline inside a block comment. The audit view already has line splices
6113 * removed. This locates its extent; tdx_directive validates consumed content. */
6114static bool tdx_directive_end(const char *s, size_t n, size_t *at, uint32_t *line) {
6115 while (*at < n) {
6116 if (s[*at] == '\0')
6117 return false;
6118 if (s[*at] == '\n') {
6119 (*at)++;
6120 (*line)++;
6121 return true;
6122 }
6123 if (*at + 1 < n && s[*at] == '/' && s[*at + 1] == '*') {
6124 *at += 2;
6125 while (*at + 1 < n && !(s[*at] == '*' && s[*at + 1] == '/')) {
6126 if (s[*at] == '\0')
6127 return false;
6128 if (s[*at] == '\n')
6129 (*line)++;
6130 (*at)++;
6131 }
6132 if (*at + 1 >= n)
6133 return false;
6134 *at += 2;
6135 continue;
6136 }
6137 if (*at + 1 < n && s[*at] == '/' && s[*at + 1] == '/') {
6138 *at += 2;
6139 while (*at < n && s[*at] != '\n') {
6140 if (s[*at] == '\0')
6141 return false;
6142 (*at)++;
6143 }
6144 continue;
6145 }
6146 if (tdx_pp_number(s, n, at))
6147 continue;
6148 if (s[*at] == '"' || s[*at] == '\'') {
6149 size_t before = *at;
6150 if (!tdx_audit_literal(s, n, at)) {
6151 /* Let the consumed-directive parser report malformed literal
6152 * content. Do not reinterpret its comment punctuation here. */
6153 *at = before + 1;
6154 while (*at < n && s[*at] != '\n') {
6155 if (s[*at] == '\0')
6156 return false;
6157 (*at)++;
6158 }
6159 }
6160 for (size_t i = before; i < *at; i++)
6161 if (s[i] == '\n')
6162 (*line)++;
6163 continue;
6164 }
6165 (*at)++;
6166 }
6167 return true;
6168}
6169
6170/* A replacement list referring to a configured definition is not a raw test
6171 * declaration. Surface it as unsupported instead of certifying only the

Callers 1

Calls 2

tdx_pp_numberFunction · 0.85
tdx_audit_literalFunction · 0.85

Tested by

no test coverage detected