Skip to main content

arborium_tree_sitter/
bindings.rs

1/* automatically generated by rust-bindgen 0.72.1 */
2
3pub const TREE_SITTER_LANGUAGE_VERSION: u32 = 15;
4pub const TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION: u32 = 13;
5pub type TSStateId = u16;
6pub type TSSymbol = u16;
7pub type TSFieldId = u16;
8#[repr(C)]
9#[derive(Debug)]
10pub struct TSLanguage {
11    _unused: [u8; 0],
12}
13#[repr(C)]
14#[derive(Debug)]
15pub struct TSParser {
16    _unused: [u8; 0],
17}
18#[repr(C)]
19#[derive(Debug)]
20pub struct TSTree {
21    _unused: [u8; 0],
22}
23#[repr(C)]
24#[derive(Debug)]
25pub struct TSQuery {
26    _unused: [u8; 0],
27}
28#[repr(C)]
29#[derive(Debug)]
30pub struct TSQueryCursor {
31    _unused: [u8; 0],
32}
33#[repr(C)]
34#[derive(Debug)]
35pub struct TSLookaheadIterator {
36    _unused: [u8; 0],
37}
38pub type TSDecodeFunction = ::core::option::Option<
39    unsafe extern "C" fn(string: *const u8, length: u32, code_point: *mut i32) -> u32,
40>;
41pub const TSInputEncodingUTF8: TSInputEncoding = 0;
42pub const TSInputEncodingUTF16LE: TSInputEncoding = 1;
43pub const TSInputEncodingUTF16BE: TSInputEncoding = 2;
44pub const TSInputEncodingCustom: TSInputEncoding = 3;
45pub type TSInputEncoding = ::core::ffi::c_uint;
46pub const TSSymbolTypeRegular: TSSymbolType = 0;
47pub const TSSymbolTypeAnonymous: TSSymbolType = 1;
48pub const TSSymbolTypeSupertype: TSSymbolType = 2;
49pub const TSSymbolTypeAuxiliary: TSSymbolType = 3;
50pub type TSSymbolType = ::core::ffi::c_uint;
51#[repr(C)]
52#[derive(Debug, Copy, Clone)]
53pub struct TSPoint {
54    pub row: u32,
55    pub column: u32,
56}
57#[repr(C)]
58#[derive(Debug, Copy, Clone)]
59pub struct TSRange {
60    pub start_point: TSPoint,
61    pub end_point: TSPoint,
62    pub start_byte: u32,
63    pub end_byte: u32,
64}
65#[repr(C)]
66#[derive(Debug)]
67pub struct TSInput {
68    pub payload: *mut ::core::ffi::c_void,
69    pub read: ::core::option::Option<
70        unsafe extern "C" fn(
71            payload: *mut ::core::ffi::c_void,
72            byte_index: u32,
73            position: TSPoint,
74            bytes_read: *mut u32,
75        ) -> *const ::core::ffi::c_char,
76    >,
77    pub encoding: TSInputEncoding,
78    pub decode: TSDecodeFunction,
79}
80#[repr(C)]
81#[derive(Debug, Copy, Clone)]
82pub struct TSParseState {
83    pub payload: *mut ::core::ffi::c_void,
84    pub current_byte_offset: u32,
85    pub has_error: bool,
86}
87#[repr(C)]
88#[derive(Debug, Copy, Clone)]
89pub struct TSParseOptions {
90    pub payload: *mut ::core::ffi::c_void,
91    pub progress_callback:
92        ::core::option::Option<unsafe extern "C" fn(state: *mut TSParseState) -> bool>,
93}
94pub const TSLogTypeParse: TSLogType = 0;
95pub const TSLogTypeLex: TSLogType = 1;
96pub type TSLogType = ::core::ffi::c_uint;
97#[repr(C)]
98#[derive(Debug)]
99pub struct TSLogger {
100    pub payload: *mut ::core::ffi::c_void,
101    pub log: ::core::option::Option<
102        unsafe extern "C" fn(
103            payload: *mut ::core::ffi::c_void,
104            log_type: TSLogType,
105            buffer: *const ::core::ffi::c_char,
106        ),
107    >,
108}
109#[repr(C)]
110#[derive(Debug, Copy, Clone)]
111pub struct TSInputEdit {
112    pub start_byte: u32,
113    pub old_end_byte: u32,
114    pub new_end_byte: u32,
115    pub start_point: TSPoint,
116    pub old_end_point: TSPoint,
117    pub new_end_point: TSPoint,
118}
119#[repr(C)]
120#[derive(Debug, Copy, Clone)]
121pub struct TSNode {
122    pub context: [u32; 4usize],
123    pub id: *const ::core::ffi::c_void,
124    pub tree: *const TSTree,
125}
126#[repr(C)]
127#[derive(Debug, Copy, Clone)]
128pub struct TSTreeCursor {
129    pub tree: *const ::core::ffi::c_void,
130    pub id: *const ::core::ffi::c_void,
131    pub context: [u32; 3usize],
132}
133#[repr(C)]
134#[derive(Debug)]
135pub struct TSQueryCapture {
136    pub node: TSNode,
137    pub index: u32,
138}
139pub const TSQuantifierZero: TSQuantifier = 0;
140pub const TSQuantifierZeroOrOne: TSQuantifier = 1;
141pub const TSQuantifierZeroOrMore: TSQuantifier = 2;
142pub const TSQuantifierOne: TSQuantifier = 3;
143pub const TSQuantifierOneOrMore: TSQuantifier = 4;
144pub type TSQuantifier = ::core::ffi::c_uint;
145#[repr(C)]
146#[derive(Debug)]
147pub struct TSQueryMatch {
148    pub id: u32,
149    pub pattern_index: u16,
150    pub capture_count: u16,
151    pub captures: *const TSQueryCapture,
152}
153pub const TSQueryPredicateStepTypeDone: TSQueryPredicateStepType = 0;
154pub const TSQueryPredicateStepTypeCapture: TSQueryPredicateStepType = 1;
155pub const TSQueryPredicateStepTypeString: TSQueryPredicateStepType = 2;
156pub type TSQueryPredicateStepType = ::core::ffi::c_uint;
157#[repr(C)]
158#[derive(Debug)]
159pub struct TSQueryPredicateStep {
160    pub type_: TSQueryPredicateStepType,
161    pub value_id: u32,
162}
163pub const TSQueryErrorNone: TSQueryError = 0;
164pub const TSQueryErrorSyntax: TSQueryError = 1;
165pub const TSQueryErrorNodeType: TSQueryError = 2;
166pub const TSQueryErrorField: TSQueryError = 3;
167pub const TSQueryErrorCapture: TSQueryError = 4;
168pub const TSQueryErrorStructure: TSQueryError = 5;
169pub const TSQueryErrorLanguage: TSQueryError = 6;
170pub type TSQueryError = ::core::ffi::c_uint;
171#[repr(C)]
172#[derive(Debug, Copy, Clone)]
173pub struct TSQueryCursorState {
174    pub payload: *mut ::core::ffi::c_void,
175    pub current_byte_offset: u32,
176}
177#[repr(C)]
178#[derive(Debug, Copy, Clone)]
179pub struct TSQueryCursorOptions {
180    pub payload: *mut ::core::ffi::c_void,
181    pub progress_callback:
182        ::core::option::Option<unsafe extern "C" fn(state: *mut TSQueryCursorState) -> bool>,
183}
184#[doc = " The metadata associated with a language.\n\n Currently, this metadata can be used to check the [Semantic Version](https://semver.org/)\n of the language. This version information should be used to signal if a given parser might\n be incompatible with existing queries when upgrading between major versions, or minor versions\n if it's in zerover."]
185#[repr(C)]
186#[derive(Debug, Copy, Clone)]
187pub struct TSLanguageMetadata {
188    pub major_version: u8,
189    pub minor_version: u8,
190    pub patch_version: u8,
191}
192extern "C" {
193    #[doc = " Create a new parser."]
194    pub fn ts_parser_new() -> *mut TSParser;
195}
196extern "C" {
197    #[doc = " Delete the parser, freeing all of the memory that it used."]
198    pub fn ts_parser_delete(self_: *mut TSParser);
199}
200extern "C" {
201    #[doc = " Get the parser's current language."]
202    pub fn ts_parser_language(self_: *const TSParser) -> *const TSLanguage;
203}
204extern "C" {
205    #[doc = " Set the language that the parser should use for parsing.\n\n Returns a boolean indicating whether or not the language was successfully\n assigned. True means assignment succeeded. False means there was a version\n mismatch: the language was generated with an incompatible version of the\n Tree-sitter CLI. Check the language's ABI version using [`ts_language_abi_version`]\n and compare it to this library's [`TREE_SITTER_LANGUAGE_VERSION`] and\n [`TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION`] constants."]
206    pub fn ts_parser_set_language(self_: *mut TSParser, language: *const TSLanguage) -> bool;
207}
208extern "C" {
209    #[doc = " Set the ranges of text that the parser should include when parsing.\n\n By default, the parser will always include entire documents. This function\n allows you to parse only a *portion* of a document but still return a syntax\n tree whose ranges match up with the document as a whole. You can also pass\n multiple disjoint ranges.\n\n The second and third parameters specify the location and length of an array\n of ranges. The parser does *not* take ownership of these ranges; it copies\n the data, so it doesn't matter how these ranges are allocated.\n\n If `count` is zero, then the entire document will be parsed. Otherwise,\n the given ranges must be ordered from earliest to latest in the document,\n and they must not overlap. That is, the following must hold for all:\n\n `i < count - 1`: `ranges[i].end_byte <= ranges[i + 1].start_byte`\n\n If this requirement is not satisfied, the operation will fail, the ranges\n will not be assigned, and this function will return `false`. On success,\n this function returns `true`"]
210    pub fn ts_parser_set_included_ranges(
211        self_: *mut TSParser,
212        ranges: *const TSRange,
213        count: u32,
214    ) -> bool;
215}
216extern "C" {
217    #[doc = " Get the ranges of text that the parser will include when parsing.\n\n The returned pointer is owned by the parser. The caller should not free it\n or write to it. The length of the array will be written to the given\n `count` pointer."]
218    pub fn ts_parser_included_ranges(self_: *const TSParser, count: *mut u32) -> *const TSRange;
219}
220extern "C" {
221    #[doc = " Use the parser to parse some source code and create a syntax tree.\n\n If you are parsing this document for the first time, pass `NULL` for the\n `old_tree` parameter. Otherwise, if you have already parsed an earlier\n version of this document and the document has since been edited, pass the\n previous syntax tree so that the unchanged parts of it can be reused.\n This will save time and memory. For this to work correctly, you must have\n already edited the old syntax tree using the [`ts_tree_edit`] function in a\n way that exactly matches the source code changes.\n\n The [`TSInput`] parameter lets you specify how to read the text. It has the\n following three fields:\n 1. [`read`]: A function to retrieve a chunk of text at a given byte offset\n    and (row, column) position. The function should return a pointer to the\n    text and write its length to the [`bytes_read`] pointer. The parser does\n    not take ownership of this buffer; it just borrows it until it has\n    finished reading it. The function should write a zero value to the\n    [`bytes_read`] pointer to indicate the end of the document.\n 2. [`payload`]: An arbitrary pointer that will be passed to each invocation\n    of the [`read`] function.\n 3. [`encoding`]: An indication of how the text is encoded. Either\n    `TSInputEncodingUTF8` or `TSInputEncodingUTF16`.\n\n This function returns a syntax tree on success, and `NULL` on failure. There\n are four possible reasons for failure:\n 1. The parser does not have a language assigned. Check for this using the\n[`ts_parser_language`] function.\n 2. Parsing was cancelled due to the progress callback returning true. This callback\n    is passed in [`ts_parser_parse_with_options`] inside the [`TSParseOptions`] struct.\n\n [`read`]: TSInput::read\n [`payload`]: TSInput::payload\n [`encoding`]: TSInput::encoding\n [`bytes_read`]: TSInput::read"]
222    pub fn ts_parser_parse(
223        self_: *mut TSParser,
224        old_tree: *const TSTree,
225        input: TSInput,
226    ) -> *mut TSTree;
227}
228extern "C" {
229    #[doc = " Use the parser to parse some source code and create a syntax tree, with some options.\n\n See [`ts_parser_parse`] for more details.\n\n See [`TSParseOptions`] for more details on the options."]
230    pub fn ts_parser_parse_with_options(
231        self_: *mut TSParser,
232        old_tree: *const TSTree,
233        input: TSInput,
234        parse_options: TSParseOptions,
235    ) -> *mut TSTree;
236}
237extern "C" {
238    #[doc = " Use the parser to parse some source code stored in one contiguous buffer.\n The first two parameters are the same as in the [`ts_parser_parse`] function\n above. The second two parameters indicate the location of the buffer and its\n length in bytes."]
239    pub fn ts_parser_parse_string(
240        self_: *mut TSParser,
241        old_tree: *const TSTree,
242        string: *const ::core::ffi::c_char,
243        length: u32,
244    ) -> *mut TSTree;
245}
246extern "C" {
247    #[doc = " Use the parser to parse some source code stored in one contiguous buffer with\n a given encoding. The first four parameters work the same as in the\n [`ts_parser_parse_string`] method above. The final parameter indicates whether\n the text is encoded as UTF8 or UTF16."]
248    pub fn ts_parser_parse_string_encoding(
249        self_: *mut TSParser,
250        old_tree: *const TSTree,
251        string: *const ::core::ffi::c_char,
252        length: u32,
253        encoding: TSInputEncoding,
254    ) -> *mut TSTree;
255}
256extern "C" {
257    #[doc = " Instruct the parser to start the next parse from the beginning.\n\n If the parser previously failed because of the progress callback, then\n by default, it will resume where it left off on the next call to\n [`ts_parser_parse`] or other parsing functions. If you don't want to resume,\n and instead intend to use this parser to parse some other document, you must\n call [`ts_parser_reset`] first."]
258    pub fn ts_parser_reset(self_: *mut TSParser);
259}
260extern "C" {
261    #[doc = " Set the logger that a parser should use during parsing.\n\n The parser does not take ownership over the logger payload. If a logger was\n previously assigned, the caller is responsible for releasing any memory\n owned by the previous logger."]
262    pub fn ts_parser_set_logger(self_: *mut TSParser, logger: TSLogger);
263}
264extern "C" {
265    #[doc = " Get the parser's current logger."]
266    pub fn ts_parser_logger(self_: *const TSParser) -> TSLogger;
267}
268extern "C" {
269    #[doc = " Set the file descriptor to which the parser should write debugging graphs\n during parsing. The graphs are formatted in the DOT language. You may want\n to pipe these graphs directly to a `dot(1)` process in order to generate\n SVG output. You can turn off this logging by passing a negative number."]
270    pub fn ts_parser_print_dot_graphs(self_: *mut TSParser, fd: ::core::ffi::c_int);
271}
272extern "C" {
273    #[doc = " Create a shallow copy of the syntax tree. This is very fast.\n\n You need to copy a syntax tree in order to use it on more than one thread at\n a time, as syntax trees are not thread safe."]
274    pub fn ts_tree_copy(self_: *const TSTree) -> *mut TSTree;
275}
276extern "C" {
277    #[doc = " Delete the syntax tree, freeing all of the memory that it used."]
278    pub fn ts_tree_delete(self_: *mut TSTree);
279}
280extern "C" {
281    #[doc = " Get the root node of the syntax tree."]
282    pub fn ts_tree_root_node(self_: *const TSTree) -> TSNode;
283}
284extern "C" {
285    #[doc = " Get the root node of the syntax tree, but with its position\n shifted forward by the given offset."]
286    pub fn ts_tree_root_node_with_offset(
287        self_: *const TSTree,
288        offset_bytes: u32,
289        offset_extent: TSPoint,
290    ) -> TSNode;
291}
292extern "C" {
293    #[doc = " Get the language that was used to parse the syntax tree."]
294    pub fn ts_tree_language(self_: *const TSTree) -> *const TSLanguage;
295}
296extern "C" {
297    #[doc = " Get the array of included ranges that was used to parse the syntax tree.\n\n The returned pointer must be freed by the caller."]
298    pub fn ts_tree_included_ranges(self_: *const TSTree, length: *mut u32) -> *mut TSRange;
299}
300extern "C" {
301    #[doc = " Edit the syntax tree to keep it in sync with source code that has been\n edited.\n\n You must describe the edit both in terms of byte offsets and in terms of\n (row, column) coordinates."]
302    pub fn ts_tree_edit(self_: *mut TSTree, edit: *const TSInputEdit);
303}
304extern "C" {
305    #[doc = " Compare an old edited syntax tree to a new syntax tree representing the same\n document, returning an array of ranges whose syntactic structure has changed.\n\n For this to work correctly, the old syntax tree must have been edited such\n that its ranges match up to the new tree. Generally, you'll want to call\n this function right after calling one of the [`ts_parser_parse`] functions.\n You need to pass the old tree that was passed to parse, as well as the new\n tree that was returned from that function.\n\n The returned ranges indicate areas where the hierarchical structure of syntax\n nodes (from root to leaf) has changed between the old and new trees. Characters\n outside these ranges have identical ancestor nodes in both trees.\n\n Note that the returned ranges may be slightly larger than the exact changed areas,\n but Tree-sitter attempts to make them as small as possible.\n\n The returned array is allocated using `malloc` and the caller is responsible\n for freeing it using `free`. The length of the array will be written to the\n given `length` pointer."]
306    pub fn ts_tree_get_changed_ranges(
307        old_tree: *const TSTree,
308        new_tree: *const TSTree,
309        length: *mut u32,
310    ) -> *mut TSRange;
311}
312extern "C" {
313    #[doc = " Write a DOT graph describing the syntax tree to the given file."]
314    pub fn ts_tree_print_dot_graph(self_: *const TSTree, file_descriptor: ::core::ffi::c_int);
315}
316extern "C" {
317    #[doc = " Get the node's type as a null-terminated string."]
318    pub fn ts_node_type(self_: TSNode) -> *const ::core::ffi::c_char;
319}
320extern "C" {
321    #[doc = " Get the node's type as a numerical id."]
322    pub fn ts_node_symbol(self_: TSNode) -> TSSymbol;
323}
324extern "C" {
325    #[doc = " Get the node's language."]
326    pub fn ts_node_language(self_: TSNode) -> *const TSLanguage;
327}
328extern "C" {
329    #[doc = " Get the node's type as it appears in the grammar ignoring aliases as a\n null-terminated string."]
330    pub fn ts_node_grammar_type(self_: TSNode) -> *const ::core::ffi::c_char;
331}
332extern "C" {
333    #[doc = " Get the node's type as a numerical id as it appears in the grammar ignoring\n aliases. This should be used in [`ts_language_next_state`] instead of\n [`ts_node_symbol`]."]
334    pub fn ts_node_grammar_symbol(self_: TSNode) -> TSSymbol;
335}
336extern "C" {
337    #[doc = " Get the node's start byte."]
338    pub fn ts_node_start_byte(self_: TSNode) -> u32;
339}
340extern "C" {
341    #[doc = " Get the node's start position in terms of rows and columns."]
342    pub fn ts_node_start_point(self_: TSNode) -> TSPoint;
343}
344extern "C" {
345    #[doc = " Get the node's end byte."]
346    pub fn ts_node_end_byte(self_: TSNode) -> u32;
347}
348extern "C" {
349    #[doc = " Get the node's end position in terms of rows and columns."]
350    pub fn ts_node_end_point(self_: TSNode) -> TSPoint;
351}
352extern "C" {
353    #[doc = " Get an S-expression representing the node as a string.\n\n This string is allocated with `malloc` and the caller is responsible for\n freeing it using `free`."]
354    pub fn ts_node_string(self_: TSNode) -> *mut ::core::ffi::c_char;
355}
356extern "C" {
357    #[doc = " Check if the node is null. Functions like [`ts_node_child`] and\n [`ts_node_next_sibling`] will return a null node to indicate that no such node\n was found."]
358    pub fn ts_node_is_null(self_: TSNode) -> bool;
359}
360extern "C" {
361    #[doc = " Check if the node is *named*. Named nodes correspond to named rules in the\n grammar, whereas *anonymous* nodes correspond to string literals in the\n grammar."]
362    pub fn ts_node_is_named(self_: TSNode) -> bool;
363}
364extern "C" {
365    #[doc = " Check if the node is *missing*. Missing nodes are inserted by the parser in\n order to recover from certain kinds of syntax errors."]
366    pub fn ts_node_is_missing(self_: TSNode) -> bool;
367}
368extern "C" {
369    #[doc = " Check if the node is *extra*. Extra nodes represent things like comments,\n which are not required the grammar, but can appear anywhere."]
370    pub fn ts_node_is_extra(self_: TSNode) -> bool;
371}
372extern "C" {
373    #[doc = " Check if a syntax node has been edited."]
374    pub fn ts_node_has_changes(self_: TSNode) -> bool;
375}
376extern "C" {
377    #[doc = " Check if the node is a syntax error or contains any syntax errors."]
378    pub fn ts_node_has_error(self_: TSNode) -> bool;
379}
380extern "C" {
381    #[doc = " Check if the node is a syntax error."]
382    pub fn ts_node_is_error(self_: TSNode) -> bool;
383}
384extern "C" {
385    #[doc = " Get this node's parse state."]
386    pub fn ts_node_parse_state(self_: TSNode) -> TSStateId;
387}
388extern "C" {
389    #[doc = " Get the parse state after this node."]
390    pub fn ts_node_next_parse_state(self_: TSNode) -> TSStateId;
391}
392extern "C" {
393    #[doc = " Get the node's immediate parent.\n Prefer [`ts_node_child_with_descendant`] for\n iterating over the node's ancestors."]
394    pub fn ts_node_parent(self_: TSNode) -> TSNode;
395}
396extern "C" {
397    #[doc = " Get the node that contains `descendant`.\n\n Note that this can return `descendant` itself."]
398    pub fn ts_node_child_with_descendant(self_: TSNode, descendant: TSNode) -> TSNode;
399}
400extern "C" {
401    #[doc = " Get the node's child at the given index, where zero represents the first\n child."]
402    pub fn ts_node_child(self_: TSNode, child_index: u32) -> TSNode;
403}
404extern "C" {
405    #[doc = " Get the field name for node's child at the given index, where zero represents\n the first child. Returns NULL, if no field is found."]
406    pub fn ts_node_field_name_for_child(
407        self_: TSNode,
408        child_index: u32,
409    ) -> *const ::core::ffi::c_char;
410}
411extern "C" {
412    #[doc = " Get the field name for node's named child at the given index, where zero\n represents the first named child. Returns NULL, if no field is found."]
413    pub fn ts_node_field_name_for_named_child(
414        self_: TSNode,
415        named_child_index: u32,
416    ) -> *const ::core::ffi::c_char;
417}
418extern "C" {
419    #[doc = " Get the node's number of children."]
420    pub fn ts_node_child_count(self_: TSNode) -> u32;
421}
422extern "C" {
423    #[doc = " Get the node's *named* child at the given index.\n\n See also [`ts_node_is_named`]."]
424    pub fn ts_node_named_child(self_: TSNode, child_index: u32) -> TSNode;
425}
426extern "C" {
427    #[doc = " Get the node's number of *named* children.\n\n See also [`ts_node_is_named`]."]
428    pub fn ts_node_named_child_count(self_: TSNode) -> u32;
429}
430extern "C" {
431    #[doc = " Get the node's child with the given field name."]
432    pub fn ts_node_child_by_field_name(
433        self_: TSNode,
434        name: *const ::core::ffi::c_char,
435        name_length: u32,
436    ) -> TSNode;
437}
438extern "C" {
439    #[doc = " Get the node's child with the given numerical field id.\n\n You can convert a field name to an id using the\n [`ts_language_field_id_for_name`] function."]
440    pub fn ts_node_child_by_field_id(self_: TSNode, field_id: TSFieldId) -> TSNode;
441}
442extern "C" {
443    #[doc = " Get the node's next / previous sibling."]
444    pub fn ts_node_next_sibling(self_: TSNode) -> TSNode;
445}
446extern "C" {
447    pub fn ts_node_prev_sibling(self_: TSNode) -> TSNode;
448}
449extern "C" {
450    #[doc = " Get the node's next / previous *named* sibling."]
451    pub fn ts_node_next_named_sibling(self_: TSNode) -> TSNode;
452}
453extern "C" {
454    pub fn ts_node_prev_named_sibling(self_: TSNode) -> TSNode;
455}
456extern "C" {
457    #[doc = " Get the node's first child that contains or starts after the given byte offset."]
458    pub fn ts_node_first_child_for_byte(self_: TSNode, byte: u32) -> TSNode;
459}
460extern "C" {
461    #[doc = " Get the node's first named child that contains or starts after the given byte offset."]
462    pub fn ts_node_first_named_child_for_byte(self_: TSNode, byte: u32) -> TSNode;
463}
464extern "C" {
465    #[doc = " Get the node's number of descendants, including one for the node itself."]
466    pub fn ts_node_descendant_count(self_: TSNode) -> u32;
467}
468extern "C" {
469    #[doc = " Get the smallest node within this node that spans the given range of bytes\n or (row, column) positions."]
470    pub fn ts_node_descendant_for_byte_range(self_: TSNode, start: u32, end: u32) -> TSNode;
471}
472extern "C" {
473    pub fn ts_node_descendant_for_point_range(
474        self_: TSNode,
475        start: TSPoint,
476        end: TSPoint,
477    ) -> TSNode;
478}
479extern "C" {
480    #[doc = " Get the smallest named node within this node that spans the given range of\n bytes or (row, column) positions."]
481    pub fn ts_node_named_descendant_for_byte_range(self_: TSNode, start: u32, end: u32) -> TSNode;
482}
483extern "C" {
484    pub fn ts_node_named_descendant_for_point_range(
485        self_: TSNode,
486        start: TSPoint,
487        end: TSPoint,
488    ) -> TSNode;
489}
490extern "C" {
491    #[doc = " Edit the node to keep it in-sync with source code that has been edited.\n\n This function is only rarely needed. When you edit a syntax tree with the\n [`ts_tree_edit`] function, all of the nodes that you retrieve from the tree\n afterward will already reflect the edit. You only need to use [`ts_node_edit`]\n when you have a [`TSNode`] instance that you want to keep and continue to use\n after an edit."]
492    pub fn ts_node_edit(self_: *mut TSNode, edit: *const TSInputEdit);
493}
494extern "C" {
495    #[doc = " Check if two nodes are identical."]
496    pub fn ts_node_eq(self_: TSNode, other: TSNode) -> bool;
497}
498extern "C" {
499    #[doc = " Edit a point to keep it in-sync with source code that has been edited.\n\n This function updates a single point's byte offset and row/column position\n based on an edit operation. This is useful for editing points without\n requiring a tree or node instance."]
500    pub fn ts_point_edit(point: *mut TSPoint, point_byte: *mut u32, edit: *const TSInputEdit);
501}
502extern "C" {
503    #[doc = " Edit a range to keep it in-sync with source code that has been edited.\n\n This function updates a range's start and end positions based on an edit\n operation. This is useful for editing ranges without requiring a tree\n or node instance."]
504    pub fn ts_range_edit(range: *mut TSRange, edit: *const TSInputEdit);
505}
506extern "C" {
507    #[doc = " Create a new tree cursor starting from the given node.\n\n A tree cursor allows you to walk a syntax tree more efficiently than is\n possible using the [`TSNode`] functions. It is a mutable object that is always\n on a certain syntax node, and can be moved imperatively to different nodes.\n\n Note that the given node is considered the root of the cursor,\n and the cursor cannot walk outside this node."]
508    pub fn ts_tree_cursor_new(node: TSNode) -> TSTreeCursor;
509}
510extern "C" {
511    #[doc = " Delete a tree cursor, freeing all of the memory that it used."]
512    pub fn ts_tree_cursor_delete(self_: *mut TSTreeCursor);
513}
514extern "C" {
515    #[doc = " Re-initialize a tree cursor to start at the original node that the cursor was\n constructed with."]
516    pub fn ts_tree_cursor_reset(self_: *mut TSTreeCursor, node: TSNode);
517}
518extern "C" {
519    #[doc = " Re-initialize a tree cursor to the same position as another cursor.\n\n Unlike [`ts_tree_cursor_reset`], this will not lose parent information and\n allows reusing already created cursors."]
520    pub fn ts_tree_cursor_reset_to(dst: *mut TSTreeCursor, src: *const TSTreeCursor);
521}
522extern "C" {
523    #[doc = " Get the tree cursor's current node."]
524    pub fn ts_tree_cursor_current_node(self_: *const TSTreeCursor) -> TSNode;
525}
526extern "C" {
527    #[doc = " Get the field name of the tree cursor's current node.\n\n This returns `NULL` if the current node doesn't have a field.\n See also [`ts_node_child_by_field_name`]."]
528    pub fn ts_tree_cursor_current_field_name(
529        self_: *const TSTreeCursor,
530    ) -> *const ::core::ffi::c_char;
531}
532extern "C" {
533    #[doc = " Get the field id of the tree cursor's current node.\n\n This returns zero if the current node doesn't have a field.\n See also [`ts_node_child_by_field_id`], [`ts_language_field_id_for_name`]."]
534    pub fn ts_tree_cursor_current_field_id(self_: *const TSTreeCursor) -> TSFieldId;
535}
536extern "C" {
537    #[doc = " Move the cursor to the parent of its current node.\n\n This returns `true` if the cursor successfully moved, and returns `false`\n if there was no parent node (the cursor was already on the root node).\n\n Note that the node the cursor was constructed with is considered the root\n of the cursor, and the cursor cannot walk outside this node."]
538    pub fn ts_tree_cursor_goto_parent(self_: *mut TSTreeCursor) -> bool;
539}
540extern "C" {
541    #[doc = " Move the cursor to the next sibling of its current node.\n\n This returns `true` if the cursor successfully moved, and returns `false`\n if there was no next sibling node.\n\n Note that the node the cursor was constructed with is considered the root\n of the cursor, and the cursor cannot walk outside this node."]
542    pub fn ts_tree_cursor_goto_next_sibling(self_: *mut TSTreeCursor) -> bool;
543}
544extern "C" {
545    #[doc = " Move the cursor to the previous sibling of its current node.\n\n This returns `true` if the cursor successfully moved, and returns `false` if\n there was no previous sibling node.\n\n Note, that this function may be slower than\n [`ts_tree_cursor_goto_next_sibling`] due to how node positions are stored. In\n the worst case, this will need to iterate through all the children up to the\n previous sibling node to recalculate its position. Also note that the node the cursor\n was constructed with is considered the root of the cursor, and the cursor cannot\n walk outside this node."]
546    pub fn ts_tree_cursor_goto_previous_sibling(self_: *mut TSTreeCursor) -> bool;
547}
548extern "C" {
549    #[doc = " Move the cursor to the first child of its current node.\n\n This returns `true` if the cursor successfully moved, and returns `false`\n if there were no children."]
550    pub fn ts_tree_cursor_goto_first_child(self_: *mut TSTreeCursor) -> bool;
551}
552extern "C" {
553    #[doc = " Move the cursor to the last child of its current node.\n\n This returns `true` if the cursor successfully moved, and returns `false` if\n there were no children.\n\n Note that this function may be slower than [`ts_tree_cursor_goto_first_child`]\n because it needs to iterate through all the children to compute the child's\n position."]
554    pub fn ts_tree_cursor_goto_last_child(self_: *mut TSTreeCursor) -> bool;
555}
556extern "C" {
557    #[doc = " Move the cursor to the node that is the nth descendant of\n the original node that the cursor was constructed with, where\n zero represents the original node itself."]
558    pub fn ts_tree_cursor_goto_descendant(self_: *mut TSTreeCursor, goal_descendant_index: u32);
559}
560extern "C" {
561    #[doc = " Get the index of the cursor's current node out of all of the\n descendants of the original node that the cursor was constructed with."]
562    pub fn ts_tree_cursor_current_descendant_index(self_: *const TSTreeCursor) -> u32;
563}
564extern "C" {
565    #[doc = " Get the depth of the cursor's current node relative to the original\n node that the cursor was constructed with."]
566    pub fn ts_tree_cursor_current_depth(self_: *const TSTreeCursor) -> u32;
567}
568extern "C" {
569    #[doc = " Move the cursor to the first child of its current node that contains or starts after\n the given byte offset or point.\n\n This returns the index of the child node if one was found, and returns -1\n if no such child was found."]
570    pub fn ts_tree_cursor_goto_first_child_for_byte(
571        self_: *mut TSTreeCursor,
572        goal_byte: u32,
573    ) -> i64;
574}
575extern "C" {
576    pub fn ts_tree_cursor_goto_first_child_for_point(
577        self_: *mut TSTreeCursor,
578        goal_point: TSPoint,
579    ) -> i64;
580}
581extern "C" {
582    pub fn ts_tree_cursor_copy(cursor: *const TSTreeCursor) -> TSTreeCursor;
583}
584extern "C" {
585    #[doc = " Create a new query from a string containing one or more S-expression\n patterns. The query is associated with a particular language, and can\n only be run on syntax nodes parsed with that language.\n\n If all of the given patterns are valid, this returns a [`TSQuery`].\n If a pattern is invalid, this returns `NULL`, and provides two pieces\n of information about the problem:\n 1. The byte offset of the error is written to the `error_offset` parameter.\n 2. The type of error is written to the `error_type` parameter."]
586    pub fn ts_query_new(
587        language: *const TSLanguage,
588        source: *const ::core::ffi::c_char,
589        source_len: u32,
590        error_offset: *mut u32,
591        error_type: *mut TSQueryError,
592    ) -> *mut TSQuery;
593}
594extern "C" {
595    #[doc = " Delete a query, freeing all of the memory that it used."]
596    pub fn ts_query_delete(self_: *mut TSQuery);
597}
598extern "C" {
599    #[doc = " Get the number of patterns, captures, or string literals in the query."]
600    pub fn ts_query_pattern_count(self_: *const TSQuery) -> u32;
601}
602extern "C" {
603    pub fn ts_query_capture_count(self_: *const TSQuery) -> u32;
604}
605extern "C" {
606    pub fn ts_query_string_count(self_: *const TSQuery) -> u32;
607}
608extern "C" {
609    #[doc = " Get the byte offset where the given pattern starts in the query's source.\n\n This can be useful when combining queries by concatenating their source\n code strings."]
610    pub fn ts_query_start_byte_for_pattern(self_: *const TSQuery, pattern_index: u32) -> u32;
611}
612extern "C" {
613    #[doc = " Get the byte offset where the given pattern ends in the query's source.\n\n This can be useful when combining queries by concatenating their source\n code strings."]
614    pub fn ts_query_end_byte_for_pattern(self_: *const TSQuery, pattern_index: u32) -> u32;
615}
616extern "C" {
617    #[doc = " Get all of the predicates for the given pattern in the query.\n\n The predicates are represented as a single array of steps. There are three\n types of steps in this array, which correspond to the three legal values for\n the `type` field:\n - `TSQueryPredicateStepTypeCapture` - Steps with this type represent names\n    of captures. Their `value_id` can be used with the\n   [`ts_query_capture_name_for_id`] function to obtain the name of the capture.\n - `TSQueryPredicateStepTypeString` - Steps with this type represent literal\n    strings. Their `value_id` can be used with the\n    [`ts_query_string_value_for_id`] function to obtain their string value.\n - `TSQueryPredicateStepTypeDone` - Steps with this type are *sentinels*\n    that represent the end of an individual predicate. If a pattern has two\n    predicates, then there will be two steps with this `type` in the array."]
618    pub fn ts_query_predicates_for_pattern(
619        self_: *const TSQuery,
620        pattern_index: u32,
621        step_count: *mut u32,
622    ) -> *const TSQueryPredicateStep;
623}
624extern "C" {
625    pub fn ts_query_is_pattern_rooted(self_: *const TSQuery, pattern_index: u32) -> bool;
626}
627extern "C" {
628    pub fn ts_query_is_pattern_non_local(self_: *const TSQuery, pattern_index: u32) -> bool;
629}
630extern "C" {
631    pub fn ts_query_is_pattern_guaranteed_at_step(self_: *const TSQuery, byte_offset: u32) -> bool;
632}
633extern "C" {
634    #[doc = " Get the name and length of one of the query's captures, or one of the\n query's string literals. Each capture and string is associated with a\n numeric id based on the order that it appeared in the query's source."]
635    pub fn ts_query_capture_name_for_id(
636        self_: *const TSQuery,
637        index: u32,
638        length: *mut u32,
639    ) -> *const ::core::ffi::c_char;
640}
641extern "C" {
642    #[doc = " Get the quantifier of the query's captures. Each capture is * associated\n with a numeric id based on the order that it appeared in the query's source."]
643    pub fn ts_query_capture_quantifier_for_id(
644        self_: *const TSQuery,
645        pattern_index: u32,
646        capture_index: u32,
647    ) -> TSQuantifier;
648}
649extern "C" {
650    pub fn ts_query_string_value_for_id(
651        self_: *const TSQuery,
652        index: u32,
653        length: *mut u32,
654    ) -> *const ::core::ffi::c_char;
655}
656extern "C" {
657    #[doc = " Disable a certain capture within a query.\n\n This prevents the capture from being returned in matches, and also avoids\n any resource usage associated with recording the capture. Currently, there\n is no way to undo this."]
658    pub fn ts_query_disable_capture(
659        self_: *mut TSQuery,
660        name: *const ::core::ffi::c_char,
661        length: u32,
662    );
663}
664extern "C" {
665    #[doc = " Disable a certain pattern within a query.\n\n This prevents the pattern from matching and removes most of the overhead\n associated with the pattern. Currently, there is no way to undo this."]
666    pub fn ts_query_disable_pattern(self_: *mut TSQuery, pattern_index: u32);
667}
668extern "C" {
669    #[doc = " Create a new cursor for executing a given query.\n\n The cursor stores the state that is needed to iteratively search\n for matches. To use the query cursor, first call [`ts_query_cursor_exec`]\n to start running a given query on a given syntax node. Then, there are\n two options for consuming the results of the query:\n 1. Repeatedly call [`ts_query_cursor_next_match`] to iterate over all of the\n    *matches* in the order that they were found. Each match contains the\n    index of the pattern that matched, and an array of captures. Because\n    multiple patterns can match the same set of nodes, one match may contain\n    captures that appear *before* some of the captures from a previous match.\n 2. Repeatedly call [`ts_query_cursor_next_capture`] to iterate over all of the\n    individual *captures* in the order that they appear. This is useful if\n    don't care about which pattern matched, and just want a single ordered\n    sequence of captures.\n\n If you don't care about consuming all of the results, you can stop calling\n [`ts_query_cursor_next_match`] or [`ts_query_cursor_next_capture`] at any point.\n  You can then start executing another query on another node by calling\n  [`ts_query_cursor_exec`] again."]
670    pub fn ts_query_cursor_new() -> *mut TSQueryCursor;
671}
672extern "C" {
673    #[doc = " Delete a query cursor, freeing all of the memory that it used."]
674    pub fn ts_query_cursor_delete(self_: *mut TSQueryCursor);
675}
676extern "C" {
677    #[doc = " Start running a given query on a given node."]
678    pub fn ts_query_cursor_exec(self_: *mut TSQueryCursor, query: *const TSQuery, node: TSNode);
679}
680extern "C" {
681    #[doc = " Start running a given query on a given node, with some options."]
682    pub fn ts_query_cursor_exec_with_options(
683        self_: *mut TSQueryCursor,
684        query: *const TSQuery,
685        node: TSNode,
686        query_options: *const TSQueryCursorOptions,
687    );
688}
689extern "C" {
690    #[doc = " Manage the maximum number of in-progress matches allowed by this query\n cursor.\n\n Query cursors have an optional maximum capacity for storing lists of\n in-progress captures. If this capacity is exceeded, then the\n earliest-starting match will silently be dropped to make room for further\n matches. This maximum capacity is optional — by default, query cursors allow\n any number of pending matches, dynamically allocating new space for them as\n needed as the query is executed."]
691    pub fn ts_query_cursor_did_exceed_match_limit(self_: *const TSQueryCursor) -> bool;
692}
693extern "C" {
694    pub fn ts_query_cursor_match_limit(self_: *const TSQueryCursor) -> u32;
695}
696extern "C" {
697    pub fn ts_query_cursor_set_match_limit(self_: *mut TSQueryCursor, limit: u32);
698}
699extern "C" {
700    #[doc = " Set the range of bytes in which the query will be executed.\n\n The query cursor will return matches that intersect with the given point range.\n This means that a match may be returned even if some of its captures fall\n outside the specified range, as long as at least part of the match\n overlaps with the range.\n\n For example, if a query pattern matches a node that spans a larger area\n than the specified range, but part of that node intersects with the range,\n the entire match will be returned.\n\n This will return `false` if the start byte is greater than the end byte, otherwise\n it will return `true`."]
701    pub fn ts_query_cursor_set_byte_range(
702        self_: *mut TSQueryCursor,
703        start_byte: u32,
704        end_byte: u32,
705    ) -> bool;
706}
707extern "C" {
708    #[doc = " Set the range of (row, column) positions in which the query will be executed.\n\n The query cursor will return matches that intersect with the given point range.\n This means that a match may be returned even if some of its captures fall\n outside the specified range, as long as at least part of the match\n overlaps with the range.\n\n For example, if a query pattern matches a node that spans a larger area\n than the specified range, but part of that node intersects with the range,\n the entire match will be returned.\n\n This will return `false` if the start point is greater than the end point, otherwise\n it will return `true`."]
709    pub fn ts_query_cursor_set_point_range(
710        self_: *mut TSQueryCursor,
711        start_point: TSPoint,
712        end_point: TSPoint,
713    ) -> bool;
714}
715extern "C" {
716    #[doc = " Set the byte range within which all matches must be fully contained.\n\n Set the range of bytes in which matches will be searched for. In contrast to\n `ts_query_cursor_set_byte_range`, this will restrict the query cursor to only return\n matches where _all_ nodes are _fully_ contained within the given range. Both functions\n can be used together, e.g. to search for any matches that intersect line 5000, as\n long as they are fully contained within lines 4500-5500"]
717    pub fn ts_query_cursor_set_containing_byte_range(
718        self_: *mut TSQueryCursor,
719        start_byte: u32,
720        end_byte: u32,
721    ) -> bool;
722}
723extern "C" {
724    #[doc = " Set the point range within which all matches must be fully contained.\n\n Set the range of bytes in which matches will be searched for. In contrast to\n `ts_query_cursor_set_point_range`, this will restrict the query cursor to only return\n matches where _all_ nodes are _fully_ contained within the given range. Both functions\n can be used together, e.g. to search for any matches that intersect line 5000, as\n long as they are fully contained within lines 4500-5500"]
725    pub fn ts_query_cursor_set_containing_point_range(
726        self_: *mut TSQueryCursor,
727        start_point: TSPoint,
728        end_point: TSPoint,
729    ) -> bool;
730}
731extern "C" {
732    #[doc = " Advance to the next match of the currently running query.\n\n If there is a match, write it to `*match` and return `true`.\n Otherwise, return `false`."]
733    pub fn ts_query_cursor_next_match(self_: *mut TSQueryCursor, match_: *mut TSQueryMatch)
734        -> bool;
735}
736extern "C" {
737    pub fn ts_query_cursor_remove_match(self_: *mut TSQueryCursor, match_id: u32);
738}
739extern "C" {
740    #[doc = " Advance to the next capture of the currently running query.\n\n If there is a capture, write its match to `*match` and its index within\n the match's capture list to `*capture_index`. Otherwise, return `false`."]
741    pub fn ts_query_cursor_next_capture(
742        self_: *mut TSQueryCursor,
743        match_: *mut TSQueryMatch,
744        capture_index: *mut u32,
745    ) -> bool;
746}
747extern "C" {
748    #[doc = " Set the maximum start depth for a query cursor.\n\n This prevents cursors from exploring children nodes at a certain depth.\n Note if a pattern includes many children, then they will still be checked.\n\n The zero max start depth value can be used as a special behavior and\n it helps to destructure a subtree by staying on a node and using captures\n for interested parts. Note that the zero max start depth only limit a search\n depth for a pattern's root node but other nodes that are parts of the pattern\n may be searched at any depth what defined by the pattern structure.\n\n Set to `UINT32_MAX` to remove the maximum start depth."]
749    pub fn ts_query_cursor_set_max_start_depth(self_: *mut TSQueryCursor, max_start_depth: u32);
750}
751extern "C" {
752    #[doc = " Get another reference to the given language."]
753    pub fn ts_language_copy(self_: *const TSLanguage) -> *const TSLanguage;
754}
755extern "C" {
756    #[doc = " Free any dynamically-allocated resources for this language, if\n this is the last reference."]
757    pub fn ts_language_delete(self_: *const TSLanguage);
758}
759extern "C" {
760    #[doc = " Get the number of distinct node types in the language."]
761    pub fn ts_language_symbol_count(self_: *const TSLanguage) -> u32;
762}
763extern "C" {
764    #[doc = " Get the number of valid states in this language."]
765    pub fn ts_language_state_count(self_: *const TSLanguage) -> u32;
766}
767extern "C" {
768    #[doc = " Get the numerical id for the given node type string."]
769    pub fn ts_language_symbol_for_name(
770        self_: *const TSLanguage,
771        string: *const ::core::ffi::c_char,
772        length: u32,
773        is_named: bool,
774    ) -> TSSymbol;
775}
776extern "C" {
777    #[doc = " Get the number of distinct field names in the language."]
778    pub fn ts_language_field_count(self_: *const TSLanguage) -> u32;
779}
780extern "C" {
781    #[doc = " Get the field name string for the given numerical id."]
782    pub fn ts_language_field_name_for_id(
783        self_: *const TSLanguage,
784        id: TSFieldId,
785    ) -> *const ::core::ffi::c_char;
786}
787extern "C" {
788    #[doc = " Get the numerical id for the given field name string."]
789    pub fn ts_language_field_id_for_name(
790        self_: *const TSLanguage,
791        name: *const ::core::ffi::c_char,
792        name_length: u32,
793    ) -> TSFieldId;
794}
795extern "C" {
796    #[doc = " Get a list of all supertype symbols for the language."]
797    pub fn ts_language_supertypes(self_: *const TSLanguage, length: *mut u32) -> *const TSSymbol;
798}
799extern "C" {
800    #[doc = " Get a list of all subtype symbol ids for a given supertype symbol.\n\n See [`ts_language_supertypes`] for fetching all supertype symbols."]
801    pub fn ts_language_subtypes(
802        self_: *const TSLanguage,
803        supertype: TSSymbol,
804        length: *mut u32,
805    ) -> *const TSSymbol;
806}
807extern "C" {
808    #[doc = " Get a node type string for the given numerical id."]
809    pub fn ts_language_symbol_name(
810        self_: *const TSLanguage,
811        symbol: TSSymbol,
812    ) -> *const ::core::ffi::c_char;
813}
814extern "C" {
815    #[doc = " Check whether the given node type id belongs to named nodes, anonymous nodes,\n or a hidden nodes.\n\n See also [`ts_node_is_named`]. Hidden nodes are never returned from the API."]
816    pub fn ts_language_symbol_type(self_: *const TSLanguage, symbol: TSSymbol) -> TSSymbolType;
817}
818extern "C" {
819    #[doc = " Get the ABI version number for this language. This version number is used\n to ensure that languages were generated by a compatible version of\n Tree-sitter.\n\n See also [`ts_parser_set_language`]."]
820    pub fn ts_language_abi_version(self_: *const TSLanguage) -> u32;
821}
822extern "C" {
823    #[doc = " Get the metadata for this language. This information is generated by the\n CLI, and relies on the language author providing the correct metadata in\n the language's `tree-sitter.json` file.\n\n See also [`TSMetadata`]."]
824    pub fn ts_language_metadata(self_: *const TSLanguage) -> *const TSLanguageMetadata;
825}
826extern "C" {
827    #[doc = " Get the next parse state. Combine this with lookahead iterators to generate\n completion suggestions or valid symbols in error nodes. Use\n [`ts_node_grammar_symbol`] for valid symbols."]
828    pub fn ts_language_next_state(
829        self_: *const TSLanguage,
830        state: TSStateId,
831        symbol: TSSymbol,
832    ) -> TSStateId;
833}
834extern "C" {
835    #[doc = " Get the name of this language. This returns `NULL` in older parsers."]
836    pub fn ts_language_name(self_: *const TSLanguage) -> *const ::core::ffi::c_char;
837}
838extern "C" {
839    #[doc = " Create a new lookahead iterator for the given language and parse state.\n\n This returns `NULL` if state is invalid for the language.\n\n Repeatedly using [`ts_lookahead_iterator_next`] and\n [`ts_lookahead_iterator_current_symbol`] will generate valid symbols in the\n given parse state. Newly created lookahead iterators will contain the `ERROR`\n symbol.\n\n Lookahead iterators can be useful to generate suggestions and improve syntax\n error diagnostics. To get symbols valid in an ERROR node, use the lookahead\n iterator on its first leaf node state. For `MISSING` nodes, a lookahead\n iterator created on the previous non-extra leaf node may be appropriate."]
840    pub fn ts_lookahead_iterator_new(
841        self_: *const TSLanguage,
842        state: TSStateId,
843    ) -> *mut TSLookaheadIterator;
844}
845extern "C" {
846    #[doc = " Delete a lookahead iterator freeing all the memory used."]
847    pub fn ts_lookahead_iterator_delete(self_: *mut TSLookaheadIterator);
848}
849extern "C" {
850    #[doc = " Reset the lookahead iterator to another state.\n\n This returns `true` if the iterator was reset to the given state and `false`\n otherwise."]
851    pub fn ts_lookahead_iterator_reset_state(
852        self_: *mut TSLookaheadIterator,
853        state: TSStateId,
854    ) -> bool;
855}
856extern "C" {
857    #[doc = " Reset the lookahead iterator.\n\n This returns `true` if the language was set successfully and `false`\n otherwise."]
858    pub fn ts_lookahead_iterator_reset(
859        self_: *mut TSLookaheadIterator,
860        language: *const TSLanguage,
861        state: TSStateId,
862    ) -> bool;
863}
864extern "C" {
865    #[doc = " Get the current language of the lookahead iterator."]
866    pub fn ts_lookahead_iterator_language(self_: *const TSLookaheadIterator) -> *const TSLanguage;
867}
868extern "C" {
869    #[doc = " Advance the lookahead iterator to the next symbol.\n\n This returns `true` if there is a new symbol and `false` otherwise."]
870    pub fn ts_lookahead_iterator_next(self_: *mut TSLookaheadIterator) -> bool;
871}
872extern "C" {
873    #[doc = " Get the current symbol of the lookahead iterator;"]
874    pub fn ts_lookahead_iterator_current_symbol(self_: *const TSLookaheadIterator) -> TSSymbol;
875}
876extern "C" {
877    #[doc = " Get the current symbol type of the lookahead iterator as a null terminated\n string."]
878    pub fn ts_lookahead_iterator_current_symbol_name(
879        self_: *const TSLookaheadIterator,
880    ) -> *const ::core::ffi::c_char;
881}
882#[repr(C)]
883#[derive(Debug, Copy, Clone)]
884pub struct wasm_engine_t {
885    _unused: [u8; 0],
886}
887pub type TSWasmEngine = wasm_engine_t;
888#[repr(C)]
889#[derive(Debug, Copy, Clone)]
890pub struct TSWasmStore {
891    _unused: [u8; 0],
892}
893pub const TSWasmErrorKindNone: TSWasmErrorKind = 0;
894pub const TSWasmErrorKindParse: TSWasmErrorKind = 1;
895pub const TSWasmErrorKindCompile: TSWasmErrorKind = 2;
896pub const TSWasmErrorKindInstantiate: TSWasmErrorKind = 3;
897pub const TSWasmErrorKindAllocate: TSWasmErrorKind = 4;
898pub type TSWasmErrorKind = ::core::ffi::c_uint;
899#[repr(C)]
900#[derive(Debug, Copy, Clone)]
901pub struct TSWasmError {
902    pub kind: TSWasmErrorKind,
903    pub message: *mut ::core::ffi::c_char,
904}
905extern "C" {
906    #[doc = " Create a Wasm store."]
907    pub fn ts_wasm_store_new(
908        engine: *mut TSWasmEngine,
909        error: *mut TSWasmError,
910    ) -> *mut TSWasmStore;
911}
912extern "C" {
913    #[doc = " Free the memory associated with the given Wasm store."]
914    pub fn ts_wasm_store_delete(arg1: *mut TSWasmStore);
915}
916extern "C" {
917    #[doc = " Create a language from a buffer of Wasm. The resulting language behaves\n like any other Tree-sitter language, except that in order to use it with\n a parser, that parser must have a Wasm store. Note that the language\n can be used with any Wasm store, it doesn't need to be the same store that\n was used to originally load it."]
918    pub fn ts_wasm_store_load_language(
919        arg1: *mut TSWasmStore,
920        name: *const ::core::ffi::c_char,
921        wasm: *const ::core::ffi::c_char,
922        wasm_len: u32,
923        error: *mut TSWasmError,
924    ) -> *const TSLanguage;
925}
926extern "C" {
927    #[doc = " Get the number of languages instantiated in the given Wasm store."]
928    pub fn ts_wasm_store_language_count(arg1: *const TSWasmStore) -> usize;
929}
930extern "C" {
931    #[doc = " Check if the language came from a Wasm module. If so, then in order to use\n this language with a Parser, that parser must have a Wasm store assigned."]
932    pub fn ts_language_is_wasm(arg1: *const TSLanguage) -> bool;
933}
934extern "C" {
935    #[doc = " Assign the given Wasm store to the parser. A parser must have a Wasm store\n in order to use Wasm languages."]
936    pub fn ts_parser_set_wasm_store(arg1: *mut TSParser, arg2: *mut TSWasmStore);
937}
938extern "C" {
939    #[doc = " Remove the parser's current Wasm store and return it. This returns NULL if\n the parser doesn't have a Wasm store."]
940    pub fn ts_parser_take_wasm_store(arg1: *mut TSParser) -> *mut TSWasmStore;
941}
942extern "C" {
943    #[doc = " Set the allocation functions used by the library.\n\n By default, Tree-sitter uses the standard libc allocation functions,\n but aborts the process when an allocation fails. This function lets\n you supply alternative allocation functions at runtime.\n\n If you pass `NULL` for any parameter, Tree-sitter will switch back to\n its default implementation of that function.\n\n If you call this function after the library has already been used, then\n you must ensure that either:\n  1. All the existing objects have been freed.\n  2. The new allocator shares its state with the old one, so it is capable\n     of freeing memory that was allocated by the old allocator."]
944    pub fn ts_set_allocator(
945        new_malloc: ::core::option::Option<
946            unsafe extern "C" fn(arg1: usize) -> *mut ::core::ffi::c_void,
947        >,
948        new_calloc: ::core::option::Option<
949            unsafe extern "C" fn(arg1: usize, arg2: usize) -> *mut ::core::ffi::c_void,
950        >,
951        new_realloc: ::core::option::Option<
952            unsafe extern "C" fn(
953                arg1: *mut ::core::ffi::c_void,
954                arg2: usize,
955            ) -> *mut ::core::ffi::c_void,
956        >,
957        new_free: ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>,
958    );
959}