MCPcopy Create free account
hub / github.com/IBM/Project_CodeNet / detect_lang

Function detect_lang

tools/tokenizer/token_common.c:213–223  ·  view source on GitHub ↗

Determine programming language from filename extension: .c | C .cc, .C, .cpp | C++ .java | Java Uses global filename (maybe stdin). */

Source from the content-addressed store, hash-verified

211 Uses global filename (maybe stdin).
212*/
213Language detect_lang(void)
214{
215 char *p;
216 if (p = strrchr(filename, '.')) {
217 int i;
218 for (i = 0; i < sizeof(langs)/sizeof(langs[0]); i++)
219 if (!strcmp(p, langs[i].ext))
220 return langs[i].lang;
221 }
222 return C;
223}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected