Disambiguate .cls files: shared by InterSystems ObjectScript UDL, Salesforce * Apex and Visual Basic 6 class modules (#721). ObjectScript class files begin * with a line of the form "Class ..."; VB6 class modules * carry the VB6 header markers and are reported as unsupported (CBM_LANG_COUNT) * until a Visual Basic grammar exists. Defaults to Apex on any doubt. */
| 1438 | * carry the VB6 header markers and are reported as unsupported (CBM_LANG_COUNT) |
| 1439 | * until a Visual Basic grammar exists. Defaults to Apex on any doubt. */ |
| 1440 | static CBMLanguage lang_cls_text(const char *buf) { |
| 1441 | if (has_vb6_markers(buf)) { |
| 1442 | return CBM_LANG_COUNT; |
| 1443 | } |
| 1444 | |
| 1445 | const char *line = buf; |
| 1446 | while (*line) { |
| 1447 | if (strncmp(line, "Class ", SLEN("Class ")) == 0 && |
| 1448 | isupper((unsigned char)line[SLEN("Class ")])) { |
| 1449 | return CBM_LANG_OBJECTSCRIPT_UDL; |
| 1450 | } |
| 1451 | const char *nl = strchr(line, '\n'); |
| 1452 | if (!nl) { |
| 1453 | break; |
| 1454 | } |
| 1455 | line = nl + SKIP_ONE; |
| 1456 | } |
| 1457 | return CBM_LANG_APEX; |
| 1458 | } |
| 1459 | |
| 1460 | CBMLanguage cbm_disambiguate_cls(const char *path) { |
| 1461 | unsigned char head[LANG_PROBE_HEAD]; |
no test coverage detected