Descend left-most through wrapper nodes to the first identifier-bearing leaf. Used by HDL call nodes whose callee identifier is nested under one or more grammar wrappers (Verilog tf_call -> simple_identifier; SystemVerilog tf_call -> hierarchical_identifier -> simple_identifier).
| 1274 | // grammar wrappers (Verilog tf_call -> simple_identifier; SystemVerilog |
| 1275 | // tf_call -> hierarchical_identifier -> simple_identifier). |
| 1276 | static char *first_leaf_identifier(CBMArena *a, TSNode node, const char *source) { |
| 1277 | TSNode cur = node; |
| 1278 | for (int depth = 0; depth < 8 && !ts_node_is_null(cur); depth++) { |
| 1279 | const char *k = ts_node_type(cur); |
| 1280 | if (strcmp(k, "simple_identifier") == 0 || strcmp(k, "identifier") == 0 || |
| 1281 | strcmp(k, "word") == 0 || strcmp(k, "name") == 0 || strcmp(k, "qid") == 0) { |
| 1282 | char *t = cbm_node_text(a, cur, source); |
| 1283 | return (t && t[0]) ? t : NULL; |
| 1284 | } |
| 1285 | if (ts_node_named_child_count(cur) == 0) { |
| 1286 | return NULL; |
| 1287 | } |
| 1288 | cur = ts_node_named_child(cur, 0); |
| 1289 | } |
| 1290 | return NULL; |
| 1291 | } |
| 1292 | |
| 1293 | // Verilog / SystemVerilog: a function_subroutine_call wraps |
| 1294 | // subroutine_call -> tf_call -> [hierarchical_identifier ->] simple_identifier. |
no test coverage detected