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

Function gql_skip_opaque

internal/cbm/service_patterns.c:947–975  ·  view source on GitHub ↗

Skip one lexical unit whose braces are not structure: a # comment, a "..." * or """...""" string, or a JS ${...} template interpolation. Returns p * unchanged when p starts none of them. */

Source from the content-addressed store, hash-verified

945 * or """...""" string, or a JS ${...} template interpolation. Returns p
946 * unchanged when p starts none of them. */
947static const char *gql_skip_opaque(const char *p) {
948 if (*p == '#') {
949 while (*p && *p != '\n' && *p != '\r') {
950 p++;
951 }
952 return p;
953 }
954 if (strncmp(p, "\"\"\"", 3) == 0) {
955 const char *end = strstr(p + 3, "\"\"\"");
956 return end ? end + 3 : p + strlen(p);
957 }
958 if (*p == '"') {
959 p++;
960 while (*p && *p != '"') {
961 p += (*p == '\\' && p[1]) ? 2 : 1;
962 }
963 return *p ? p + 1 : p;
964 }
965 if (p[0] == '$' && p[1] == '{') {
966 int depth = 1;
967 p += 2;
968 while (*p && depth > 0) {
969 depth += (*p == '{') - (*p == '}');
970 p++;
971 }
972 return p;
973 }
974 return p;
975}
976
977/* Skip GraphQL "ignored tokens" (whitespace, commas, comments). */
978static const char *gql_skip_ignored(const char *p) {

Callers 2

gql_skip_ignoredFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected