Avoid one heap allocation when instantiating a TSTreeCursor
This commit is contained in:
parent
6fc8d9871c
commit
e3670be42f
8 changed files with 96 additions and 86 deletions
|
|
@ -16,7 +16,6 @@ typedef unsigned short TSSymbol;
|
|||
typedef struct TSLanguage TSLanguage;
|
||||
typedef struct TSParser TSParser;
|
||||
typedef struct TSTree TSTree;
|
||||
typedef struct TSTreeCursor TSTreeCursor;
|
||||
|
||||
typedef enum {
|
||||
TSInputEncodingUTF8,
|
||||
|
|
@ -66,10 +65,15 @@ typedef struct {
|
|||
} TSInputEdit;
|
||||
|
||||
typedef struct {
|
||||
const void *ref[2];
|
||||
uint32_t context[4];
|
||||
const void *ref[2];
|
||||
} TSNode;
|
||||
|
||||
typedef struct {
|
||||
uint32_t context[2];
|
||||
void *ref[2];
|
||||
} TSTreeCursor;
|
||||
|
||||
TSParser *ts_parser_new();
|
||||
void ts_parser_delete(TSParser *);
|
||||
const TSLanguage *ts_parser_language(const TSParser *);
|
||||
|
|
@ -117,7 +121,7 @@ TSNode ts_node_named_descendant_for_byte_range(TSNode, uint32_t, uint32_t);
|
|||
TSNode ts_node_descendant_for_point_range(TSNode, TSPoint, TSPoint);
|
||||
TSNode ts_node_named_descendant_for_point_range(TSNode, TSPoint, TSPoint);
|
||||
|
||||
TSTreeCursor *ts_tree_cursor_new(const TSTree *);
|
||||
TSTreeCursor ts_tree_cursor_new(const TSTree *);
|
||||
void ts_tree_cursor_delete(TSTreeCursor *);
|
||||
bool ts_tree_cursor_goto_first_child(TSTreeCursor *);
|
||||
int64_t ts_tree_cursor_goto_first_child_for_byte(TSTreeCursor *, uint32_t);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue