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:
Max Brunsfeld 2014-09-26 16:15:07 -07:00
parent c576d7d4a0
commit c1565c1aae
16 changed files with 232 additions and 128 deletions

View file

@ -24,7 +24,7 @@ void ts_stack_shrink(TSStack *stack, size_t new_size);
void ts_stack_push(TSStack *stack, TSStateId state, TSTree *node);
TSStateId ts_stack_top_state(const TSStack *stack);
TSTree *ts_stack_top_node(const TSStack *stack);
size_t ts_stack_right_position(const TSStack *stack);
TSLength ts_stack_right_position(const TSStack *stack);
#define TS_STACK_FROM_TOP(stack, entry, index) \
size_t index = stack.size - 1; \