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

Function is_python_interp

src/discover/language.c:1095–1116  ·  view source on GitHub ↗

"python" optionally followed by an explicit numeric version (digits and dots * only, e.g. "python3", "python3.12"). Bounded and explicit so arbitrary * suffixes like "python-wrapper" are rejected. */

Source from the content-addressed store, hash-verified

1093 * only, e.g. "python3", "python3.12"). Bounded and explicit so arbitrary
1094 * suffixes like "python-wrapper" are rejected. */
1095static bool is_python_interp(const char *base) {
1096 if (strncmp(base, "python", SLEN("python")) != 0) {
1097 return false;
1098 }
1099 const char *version = base + SLEN("python");
1100 if (*version == '\0') {
1101 return true;
1102 }
1103
1104 /* Each numeric component must contain at least one digit. */
1105 bool need_digit = true;
1106 for (const char *v = version; *v; v++) {
1107 if (isdigit((unsigned char)*v)) {
1108 need_digit = false;
1109 } else if (*v == '.' && !need_digit) {
1110 need_digit = true;
1111 } else {
1112 return false;
1113 }
1114 }
1115 return !need_digit;
1116}
1117
1118/* Map an interpreter basename to a language, or CBM_LANG_COUNT if unrecognized.
1119 * Non-python interpreters are matched exactly (no prefix/suffix logic). */

Callers 1

lang_for_interpreterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected