Parse `source`, build the nth `kind` node's suffix in `mode`; the returned * string is arena-owned (NULL when absent). */
| 40 | /* Parse `source`, build the nth `kind` node's suffix in `mode`; the returned |
| 41 | * string is arena-owned (NULL when absent). */ |
| 42 | static const char *sig_of(CBMArena *a, CBMLanguage lang, CBMCallableIdentity mode, |
| 43 | const char *source, const char *kind, int nth) { |
| 44 | TSParser *parser = ts_parser_new(); |
| 45 | ts_parser_set_language(parser, cbm_ts_language(lang)); |
| 46 | TSTree *tree = ts_parser_parse_string(parser, NULL, source, (uint32_t)strlen(source)); |
| 47 | TSNode node = {0}; |
| 48 | int left = nth; |
| 49 | const char *sig = NULL; |
| 50 | if (tree && find_nth(ts_tree_root_node(tree), kind, &left, &node)) { |
| 51 | sig = cbm_callable_sig_mode(a, node, source, lang, mode); |
| 52 | } |
| 53 | ts_tree_delete(tree); |
| 54 | ts_parser_delete(parser); |
| 55 | return sig; |
| 56 | } |
| 57 | |
| 58 | static const sig_case_t k_cases[] = { |
| 59 | /* Java: generics kept, qualifiers and annotations dropped, varargs = []. */ |
no test coverage detected