| 1147 | } |
| 1148 | |
| 1149 | static void tm_ident(tm_scan_t *sc, const tm_tok_t *tok) { |
| 1150 | const cbm_test_conventions_t *conv = &sc->m->conv; |
| 1151 | tm_tok_t name; |
| 1152 | if (tm_tok_is(tok, "namespace")) { |
| 1153 | sc->m->incomplete = true; /* file-scope-only model cannot map namespace identities */ |
| 1154 | } |
| 1155 | if (sc->m->descriptor_mode) { |
| 1156 | if (tm_descriptor_ident(sc, tok)) |
| 1157 | return; |
| 1158 | if (tm_cbm_active(sc) && tm_tok_is(tok, "void")) { |
| 1159 | if (sc->depth == 0) { |
| 1160 | tm_file_scope_ident(sc, tok); |
| 1161 | } else { |
| 1162 | tm_lex_t ahead = sc->lx; |
| 1163 | if (tm_suite_function(&ahead, conv->suite_fn_prefix, &name) && |
| 1164 | tm_body_opens(&ahead)) { |
| 1165 | tm_scan_mapping(sc, CBM_TEST_MODEL_MAPPING_UNSUPPORTED_FORM, -1, tok->line); |
| 1166 | } |
| 1167 | } |
| 1168 | } |
| 1169 | return; |
| 1170 | } |
| 1171 | bool perf = tm_tok_is(tok, conv->suite_run_perf_macro); |
| 1172 | if (perf || tm_tok_is(tok, conv->suite_run_macro)) { |
| 1173 | if (tm_macro_arg(&sc->lx, &name)) { |
| 1174 | tm_add_runner_suite(sc, &name, perf); |
| 1175 | } else { |
| 1176 | sc->m->incomplete = true; |
| 1177 | } |
| 1178 | return; |
| 1179 | } |
| 1180 | if (sc->depth == 0) { |
| 1181 | if (tm_tok_is(tok, conv->run_macro)) { |
| 1182 | sc->m->incomplete = true; |
| 1183 | } |
| 1184 | tm_file_scope_ident(sc, tok); |
| 1185 | return; |
| 1186 | } |
| 1187 | if (tm_tok_is(tok, conv->case_macro) || tm_tok_is(tok, conv->suite_macro)) { |
| 1188 | sc->m->incomplete = true; /* configured definitions below file scope are unsupported */ |
| 1189 | } |
| 1190 | if (tm_tok_is(tok, "void")) { |
| 1191 | tm_lex_t ahead = sc->lx; |
| 1192 | if (tm_suite_function(&ahead, conv->suite_fn_prefix, &name) && tm_body_opens(&ahead)) { |
| 1193 | sc->m->incomplete = true; |
| 1194 | } |
| 1195 | } |
| 1196 | if (tm_tok_is(tok, conv->run_macro)) { |
| 1197 | if (sc->open == TM_OPEN_SUITE && tm_macro_arg(&sc->lx, &name)) { |
| 1198 | tm_add_registration(sc, &name, tok->line); |
| 1199 | } else { |
| 1200 | sc->m->incomplete = true; |
| 1201 | } |
| 1202 | } |
| 1203 | } |
| 1204 | |
| 1205 | static bool tm_scan_source(cbm_test_model_t *m, const char *file, const char *text, size_t len, |
| 1206 | int language_kind) { |
no test coverage detected