tsl-devkit/lsp-server/src/bridge/tree_sitter.cppm

64 lines
1.7 KiB
C++

module;
// Global module fragment: pull in third-party headers
#include <stdint.h> // For uint32_t used by tree-sitter API
#include <tree_sitter/api.h>
export module tree_sitter;
// Re-export stdint macros that modules don't automatically provide
export constexpr uint32_t UINT32_MAX_VALUE = UINT32_MAX;
// Re-export tree_sitter types and functions
export {
// C standard types needed by tree-sitter API
using ::uint32_t;
using ::uint16_t;
using ::size_t;
// C API types (already in global namespace)
using ::TSNode;
using ::TSParser;
using ::TSTree;
using ::TSLanguage;
using ::TSSymbol;
using ::TSPoint;
using ::TSRange;
using ::TSInput;
using ::TSInputEdit;
using ::TSQuery;
using ::TSQueryCursor;
using ::TSQueryCapture;
using ::TSQueryMatch;
// C API functions
using ::ts_parser_new;
using ::ts_parser_delete;
using ::ts_parser_set_language;
using ::ts_parser_parse_string;
using ::ts_tree_delete;
using ::ts_tree_edit;
using ::ts_tree_root_node;
using ::ts_node_descendant_for_byte_range;
using ::ts_node_child;
using ::ts_node_child_count;
using ::ts_node_type;
using ::ts_node_start_byte;
using ::ts_node_end_byte;
using ::ts_node_start_point;
using ::ts_node_end_point;
using ::ts_node_string;
using ::ts_node_is_null;
using ::ts_node_is_named;
using ::ts_node_is_missing;
using ::ts_node_is_error;
using ::ts_node_parent;
using ::ts_node_child_by_field_name;
using ::ts_node_field_name_for_child;
using ::ts_node_has_changes;
using ::ts_node_eq;
}
// Forward declare language function (to be defined elsewhere)
export extern "C" const TSLanguage* tree_sitter_tsf(void);