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

Function lang_for_interpreter

src/discover/language.c:985–1004  ·  view source on GitHub ↗

Map an interpreter basename to a language, or CBM_LANG_COUNT if unrecognized. * Non-python interpreters are matched exactly (no prefix/suffix logic). */

Source from the content-addressed store, hash-verified

983/* Map an interpreter basename to a language, or CBM_LANG_COUNT if unrecognized.
984 * Non-python interpreters are matched exactly (no prefix/suffix logic). */
985static CBMLanguage lang_for_interpreter(const char *base) {
986 if (is_python_interp(base)) {
987 return CBM_LANG_PYTHON;
988 }
989 static const struct {
990 const char *name;
991 CBMLanguage lang;
992 } INTERP_TABLE[] = {
993 {"sh", CBM_LANG_BASH}, {"bash", CBM_LANG_BASH}, {"dash", CBM_LANG_BASH},
994 {"ksh", CBM_LANG_BASH}, {"zsh", CBM_LANG_BASH}, {"node", CBM_LANG_JAVASCRIPT},
995 {"nodejs", CBM_LANG_JAVASCRIPT}, {"ruby", CBM_LANG_RUBY}, {"perl", CBM_LANG_PERL},
996 {"php", CBM_LANG_PHP}, {"lua", CBM_LANG_LUA},
997 };
998 for (size_t i = 0; i < sizeof(INTERP_TABLE) / sizeof(INTERP_TABLE[0]); i++) {
999 if (strcmp(base, INTERP_TABLE[i].name) == 0) {
1000 return INTERP_TABLE[i].lang;
1001 }
1002 }
1003 return CBM_LANG_COUNT;
1004}
1005
1006/* Advance *cursor past leading blanks and return the next whitespace-delimited
1007 * token (NUL-terminated in place), or NULL when the line is exhausted. */

Callers 1

Calls 1

is_python_interpFunction · 0.85

Tested by

no test coverage detected