| 1818 | } |
| 1819 | |
| 1820 | static void parse_php_imports(CBMExtractCtx *ctx) { |
| 1821 | TSTreeCursor cursor = ts_tree_cursor_new(ctx->root); |
| 1822 | if (!ts_tree_cursor_goto_first_child(&cursor)) { |
| 1823 | ts_tree_cursor_delete(&cursor); |
| 1824 | return; |
| 1825 | } |
| 1826 | do { |
| 1827 | TSNode node = ts_tree_cursor_current_node(&cursor); |
| 1828 | const char *kind = ts_node_type(node); |
| 1829 | if (strcmp(kind, "namespace_use_declaration") == 0) { |
| 1830 | emit_php_use_decl(ctx, node); |
| 1831 | } else if (strcmp(kind, "expression_statement") == 0) { |
| 1832 | // require / include / require_once / include_once |
| 1833 | if (!try_generic_path_fields(ctx, node)) { |
| 1834 | generic_import_from_text(ctx, node); |
| 1835 | } |
| 1836 | } |
| 1837 | } while (ts_tree_cursor_goto_next_sibling(&cursor)); |
| 1838 | ts_tree_cursor_delete(&cursor); |
| 1839 | } |
| 1840 | |
| 1841 | // --- C# imports --- |
| 1842 | // tree-sitter-c-sharp models `using System.Text;` as a `using_directive`. |
no test coverage detected