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
|
|
@ -27,7 +27,12 @@ describe("stacks", [&]() {
|
|||
TSTree *node1;
|
||||
|
||||
before_each([&]() {
|
||||
node1 = ts_tree_make_leaf(sym1, 5, 1, 0);
|
||||
node1 = ts_tree_make_leaf(
|
||||
sym1,
|
||||
(TSLength) { 0, 0 },
|
||||
(TSLength) { 1, 1 },
|
||||
0);
|
||||
|
||||
ts_stack_push(&stack, 5, node1);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue