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).
| 808 | // grammar wrappers (Verilog tf_call -> simple_identifier; SystemVerilog |
| 809 | // tf_call -> hierarchical_identifier -> simple_identifier). |
| 810 | static char *first_leaf_identifier(CBMArena *a, TSNode node, const char *source) { |
| 811 | TSNode cur = node; |
| 812 | for (int depth = 0; depth < 8 && !ts_node_is_null(cur); depth++) { |
| 813 | const char *k = ts_node_type(cur); |
| 814 | if (strcmp(k, "simple_identifier") == 0 || strcmp(k, "identifier") == 0 || |
| 815 | strcmp(k, "word") == 0 || strcmp(k, "name") == 0 || strcmp(k, "qid") == 0) { |
| 816 | char *t = cbm_node_text(a, cur, source); |
| 817 | return (t && t[0]) ? t : NULL; |
| 818 | } |
| 819 | if (ts_node_named_child_count(cur) == 0) { |
| 820 | return NULL; |
| 821 | } |
| 822 | cur = ts_node_named_child(cur, 0); |
| 823 | } |
| 824 | return NULL; |
| 825 | } |
| 826 | |
| 827 | // Verilog / SystemVerilog: a function_subroutine_call wraps |
| 828 | // subroutine_call -> tf_call -> [hierarchical_identifier ->] simple_identifier. |
no test coverage detected