Track AST nodes' sizes in characters as well as bytes
The `pos` and `size` functions for Nodes now return TSLength structs, which contain lengths in both characters and bytes. This is important for knowing the number of unicode characters in a Node.
This commit is contained in:
parent
c576d7d4a0
commit
c1565c1aae
16 changed files with 232 additions and 128 deletions
|
|
@ -6,15 +6,15 @@
|
|||
|
||||
struct TSNode {
|
||||
size_t ref_count;
|
||||
size_t position;
|
||||
size_t index;
|
||||
TSLength position;
|
||||
const TSTree *content;
|
||||
struct TSNode *parent;
|
||||
const char **names;
|
||||
};
|
||||
|
||||
TSNode *ts_node_make(const TSTree *tree, TSNode *parent, size_t index,
|
||||
size_t position, const char **names);
|
||||
TSLength position, const char **names);
|
||||
TSNode *ts_node_make_root(const TSTree *tree, const char **names);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue