Changed (u)int\d+_t to their stdme types
This commit is contained in:
parent
a7bfe526b0
commit
38bdd66f78
22 changed files with 1034 additions and 981 deletions
|
|
@ -1,16 +1,16 @@
|
|||
#include "./api.h"
|
||||
#include "./language.h"
|
||||
#include "./subtree.h"
|
||||
#include "./tree.h"
|
||||
#include "api.h"
|
||||
#include <stdbool.h>
|
||||
#include "me/types.h"
|
||||
|
||||
typedef struct NodeChildIterator
|
||||
{
|
||||
Subtree parent;
|
||||
const TSTree *tree;
|
||||
Length position;
|
||||
uint32_t child_index;
|
||||
uint32_t structural_child_index;
|
||||
t_u32 child_index;
|
||||
t_u32 structural_child_index;
|
||||
const TSSymbol *alias_sequence;
|
||||
} NodeChildIterator;
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ static inline TSNode ts_node__null(void)
|
|||
|
||||
// TSNode - accessors
|
||||
|
||||
uint32_t ts_node_start_byte(TSNode self)
|
||||
t_u32 ts_node_start_byte(TSNode self)
|
||||
{
|
||||
return self.context[0];
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ TSPoint ts_node_start_point(TSNode self)
|
|||
return (TSPoint){self.context[1], self.context[2]};
|
||||
}
|
||||
|
||||
static inline uint32_t ts_node__alias(const TSNode *self)
|
||||
static inline t_u32 ts_node__alias(const TSNode *self)
|
||||
{
|
||||
return self->context[3];
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ static inline bool ts_node__is_relevant(TSNode self, bool include_anonymous)
|
|||
}
|
||||
}
|
||||
|
||||
static inline uint32_t ts_node__relevant_child_count(TSNode self, bool include_anonymous)
|
||||
static inline t_u32 ts_node__relevant_child_count(TSNode self, bool include_anonymous)
|
||||
{
|
||||
Subtree tree = ts_node__subtree(self);
|
||||
if (ts_subtree_child_count(tree) > 0)
|
||||
|
|
@ -144,7 +144,7 @@ static inline uint32_t ts_node__relevant_child_count(TSNode self, bool include_a
|
|||
}
|
||||
}
|
||||
|
||||
static inline TSNode ts_node__child(TSNode self, uint32_t child_index, bool include_anonymous)
|
||||
static inline TSNode ts_node__child(TSNode self, t_u32 child_index, bool include_anonymous)
|
||||
{
|
||||
TSNode result = self;
|
||||
bool did_descend = true;
|
||||
|
|
@ -154,7 +154,7 @@ static inline TSNode ts_node__child(TSNode self, uint32_t child_index, bool incl
|
|||
did_descend = false;
|
||||
|
||||
TSNode child;
|
||||
uint32_t index = 0;
|
||||
t_u32 index = 0;
|
||||
NodeChildIterator iterator = ts_node_iterate_children(&result);
|
||||
while (ts_node_child_iterator_next(&iterator, &child))
|
||||
{
|
||||
|
|
@ -168,8 +168,8 @@ static inline TSNode ts_node__child(TSNode self, uint32_t child_index, bool incl
|
|||
}
|
||||
else
|
||||
{
|
||||
uint32_t grandchild_index = child_index - index;
|
||||
uint32_t grandchild_count = ts_node__relevant_child_count(child, include_anonymous);
|
||||
t_u32 grandchild_index = child_index - index;
|
||||
t_u32 grandchild_count = ts_node__relevant_child_count(child, include_anonymous);
|
||||
if (grandchild_index < grandchild_count)
|
||||
{
|
||||
did_descend = true;
|
||||
|
|
@ -202,9 +202,9 @@ static bool ts_subtree_has_trailing_empty_descendant(Subtree self, Subtree other
|
|||
|
||||
static inline TSNode ts_node__prev_sibling(TSNode self, bool include_anonymous)
|
||||
{
|
||||
Subtree self_subtree = ts_node__subtree(self);
|
||||
bool self_is_empty = ts_subtree_total_bytes(self_subtree) == 0;
|
||||
uint32_t target_end_byte = ts_node_end_byte(self);
|
||||
Subtree self_subtree = ts_node__subtree(self);
|
||||
bool self_is_empty = ts_subtree_total_bytes(self_subtree) == 0;
|
||||
t_u32 target_end_byte = ts_node_end_byte(self);
|
||||
|
||||
TSNode node = ts_node_parent(self);
|
||||
TSNode earlier_node = ts_node__null();
|
||||
|
|
@ -281,7 +281,7 @@ static inline TSNode ts_node__prev_sibling(TSNode self, bool include_anonymous)
|
|||
|
||||
static inline TSNode ts_node__next_sibling(TSNode self, bool include_anonymous)
|
||||
{
|
||||
uint32_t target_end_byte = ts_node_end_byte(self);
|
||||
t_u32 target_end_byte = ts_node_end_byte(self);
|
||||
|
||||
TSNode node = ts_node_parent(self);
|
||||
TSNode later_node = ts_node__null();
|
||||
|
|
@ -350,7 +350,7 @@ static inline TSNode ts_node__next_sibling(TSNode self, bool include_anonymous)
|
|||
return ts_node__null();
|
||||
}
|
||||
|
||||
static inline TSNode ts_node__first_child_for_byte(TSNode self, uint32_t goal, bool include_anonymous)
|
||||
static inline TSNode ts_node__first_child_for_byte(TSNode self, t_u32 goal, bool include_anonymous)
|
||||
{
|
||||
TSNode node = self;
|
||||
bool did_descend = true;
|
||||
|
|
@ -382,7 +382,7 @@ static inline TSNode ts_node__first_child_for_byte(TSNode self, uint32_t goal, b
|
|||
return ts_node__null();
|
||||
}
|
||||
|
||||
static inline TSNode ts_node__descendant_for_byte_range(TSNode self, uint32_t range_start, uint32_t range_end, bool include_anonymous)
|
||||
static inline TSNode ts_node__descendant_for_byte_range(TSNode self, t_u32 range_start, t_u32 range_end, bool include_anonymous)
|
||||
{
|
||||
TSNode node = self;
|
||||
TSNode last_visible_node = self;
|
||||
|
|
@ -396,7 +396,7 @@ static inline TSNode ts_node__descendant_for_byte_range(TSNode self, uint32_t ra
|
|||
NodeChildIterator iterator = ts_node_iterate_children(&node);
|
||||
while (ts_node_child_iterator_next(&iterator, &child))
|
||||
{
|
||||
uint32_t node_end = iterator.position.bytes;
|
||||
t_u32 node_end = iterator.position.bytes;
|
||||
|
||||
// The end of this node must extend far enough forward to touch
|
||||
// the end of the range and exceed the start of the range.
|
||||
|
|
@ -466,7 +466,7 @@ static inline TSNode ts_node__descendant_for_point_range(TSNode self, TSPoint ra
|
|||
|
||||
// TSNode - public
|
||||
|
||||
uint32_t ts_node_end_byte(TSNode self)
|
||||
t_u32 ts_node_end_byte(TSNode self)
|
||||
{
|
||||
return ts_node_start_byte(self) + ts_subtree_size(ts_node__subtree(self)).bytes;
|
||||
}
|
||||
|
|
@ -557,7 +557,7 @@ bool ts_node_is_error(TSNode self)
|
|||
return symbol == ts_builtin_sym_error;
|
||||
}
|
||||
|
||||
uint32_t ts_node_descendant_count(TSNode self)
|
||||
t_u32 ts_node_descendant_count(TSNode self)
|
||||
{
|
||||
return ts_subtree_visible_descendant_count(ts_node__subtree(self)) + 1;
|
||||
}
|
||||
|
|
@ -570,12 +570,12 @@ TSStateId ts_node_parse_state(TSNode self)
|
|||
TSStateId ts_node_next_parse_state(TSNode self)
|
||||
{
|
||||
const TSLanguage *language = self.tree->language;
|
||||
uint16_t state = ts_node_parse_state(self);
|
||||
t_u16 state = ts_node_parse_state(self);
|
||||
if (state == TS_TREE_STATE_NONE)
|
||||
{
|
||||
return TS_TREE_STATE_NONE;
|
||||
}
|
||||
uint16_t symbol = ts_node_grammar_symbol(self);
|
||||
t_u16 symbol = ts_node_grammar_symbol(self);
|
||||
return ts_language_next_state(language, state, symbol);
|
||||
}
|
||||
|
||||
|
|
@ -598,8 +598,8 @@ TSNode ts_node_parent(TSNode self)
|
|||
|
||||
TSNode ts_node_child_containing_descendant(TSNode self, TSNode subnode)
|
||||
{
|
||||
uint32_t start_byte = ts_node_start_byte(subnode);
|
||||
uint32_t end_byte = ts_node_end_byte(subnode);
|
||||
t_u32 start_byte = ts_node_start_byte(subnode);
|
||||
t_u32 end_byte = ts_node_end_byte(subnode);
|
||||
|
||||
do
|
||||
{
|
||||
|
|
@ -616,12 +616,12 @@ TSNode ts_node_child_containing_descendant(TSNode self, TSNode subnode)
|
|||
return self;
|
||||
}
|
||||
|
||||
TSNode ts_node_child(TSNode self, uint32_t child_index)
|
||||
TSNode ts_node_child(TSNode self, t_u32 child_index)
|
||||
{
|
||||
return ts_node__child(self, child_index, true);
|
||||
}
|
||||
|
||||
TSNode ts_node_named_child(TSNode self, uint32_t child_index)
|
||||
TSNode ts_node_named_child(TSNode self, t_u32 child_index)
|
||||
{
|
||||
return ts_node__child(self, child_index, false);
|
||||
}
|
||||
|
|
@ -658,7 +658,7 @@ recur:
|
|||
{
|
||||
if (!ts_subtree_extra(ts_node__subtree(child)))
|
||||
{
|
||||
uint32_t index = iterator.structural_child_index - 1;
|
||||
t_u32 index = iterator.structural_child_index - 1;
|
||||
if (index < field_map->child_index)
|
||||
continue;
|
||||
|
||||
|
|
@ -712,7 +712,7 @@ recur:
|
|||
return ts_node__null();
|
||||
}
|
||||
|
||||
static inline const char *ts_node__field_name_from_language(TSNode self, uint32_t structural_child_index)
|
||||
static inline const char *ts_node__field_name_from_language(TSNode self, t_u32 structural_child_index)
|
||||
{
|
||||
const TSFieldMapEntry *field_map, *field_map_end;
|
||||
ts_language_field_map(self.tree->language, ts_node__subtree(self).ptr->production_id, &field_map, &field_map_end);
|
||||
|
|
@ -726,7 +726,7 @@ static inline const char *ts_node__field_name_from_language(TSNode self, uint32_
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const char *ts_node_field_name_for_child(TSNode self, uint32_t child_index)
|
||||
const char *ts_node_field_name_for_child(TSNode self, t_u32 child_index)
|
||||
{
|
||||
TSNode result = self;
|
||||
bool did_descend = true;
|
||||
|
|
@ -737,7 +737,7 @@ const char *ts_node_field_name_for_child(TSNode self, uint32_t child_index)
|
|||
did_descend = false;
|
||||
|
||||
TSNode child;
|
||||
uint32_t index = 0;
|
||||
t_u32 index = 0;
|
||||
NodeChildIterator iterator = ts_node_iterate_children(&result);
|
||||
while (ts_node_child_iterator_next(&iterator, &child))
|
||||
{
|
||||
|
|
@ -758,8 +758,8 @@ const char *ts_node_field_name_for_child(TSNode self, uint32_t child_index)
|
|||
}
|
||||
else
|
||||
{
|
||||
uint32_t grandchild_index = child_index - index;
|
||||
uint32_t grandchild_count = ts_node__relevant_child_count(child, true);
|
||||
t_u32 grandchild_index = child_index - index;
|
||||
t_u32 grandchild_count = ts_node__relevant_child_count(child, true);
|
||||
if (grandchild_index < grandchild_count)
|
||||
{
|
||||
const char *field_name = ts_node__field_name_from_language(result, iterator.structural_child_index - 1);
|
||||
|
|
@ -779,13 +779,13 @@ const char *ts_node_field_name_for_child(TSNode self, uint32_t child_index)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
TSNode ts_node_child_by_field_name(TSNode self, const char *name, uint32_t name_length)
|
||||
TSNode ts_node_child_by_field_name(TSNode self, const char *name, t_u32 name_length)
|
||||
{
|
||||
TSFieldId field_id = ts_language_field_id_for_name(self.tree->language, name, name_length);
|
||||
return ts_node_child_by_field_id(self, field_id);
|
||||
}
|
||||
|
||||
uint32_t ts_node_child_count(TSNode self)
|
||||
t_u32 ts_node_child_count(TSNode self)
|
||||
{
|
||||
Subtree tree = ts_node__subtree(self);
|
||||
if (ts_subtree_child_count(tree) > 0)
|
||||
|
|
@ -798,7 +798,7 @@ uint32_t ts_node_child_count(TSNode self)
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t ts_node_named_child_count(TSNode self)
|
||||
t_u32 ts_node_named_child_count(TSNode self)
|
||||
{
|
||||
Subtree tree = ts_node__subtree(self);
|
||||
if (ts_subtree_child_count(tree) > 0)
|
||||
|
|
@ -831,22 +831,22 @@ TSNode ts_node_prev_named_sibling(TSNode self)
|
|||
return ts_node__prev_sibling(self, false);
|
||||
}
|
||||
|
||||
TSNode ts_node_first_child_for_byte(TSNode self, uint32_t byte)
|
||||
TSNode ts_node_first_child_for_byte(TSNode self, t_u32 byte)
|
||||
{
|
||||
return ts_node__first_child_for_byte(self, byte, true);
|
||||
}
|
||||
|
||||
TSNode ts_node_first_named_child_for_byte(TSNode self, uint32_t byte)
|
||||
TSNode ts_node_first_named_child_for_byte(TSNode self, t_u32 byte)
|
||||
{
|
||||
return ts_node__first_child_for_byte(self, byte, false);
|
||||
}
|
||||
|
||||
TSNode ts_node_descendant_for_byte_range(TSNode self, uint32_t start, uint32_t end)
|
||||
TSNode ts_node_descendant_for_byte_range(TSNode self, t_u32 start, t_u32 end)
|
||||
{
|
||||
return ts_node__descendant_for_byte_range(self, start, end, true);
|
||||
}
|
||||
|
||||
TSNode ts_node_named_descendant_for_byte_range(TSNode self, uint32_t start, uint32_t end)
|
||||
TSNode ts_node_named_descendant_for_byte_range(TSNode self, t_u32 start, t_u32 end)
|
||||
{
|
||||
return ts_node__descendant_for_byte_range(self, start, end, false);
|
||||
}
|
||||
|
|
@ -863,8 +863,8 @@ TSNode ts_node_named_descendant_for_point_range(TSNode self, TSPoint start, TSPo
|
|||
|
||||
void ts_node_edit(TSNode *self, const TSInputEdit *edit)
|
||||
{
|
||||
uint32_t start_byte = ts_node_start_byte(*self);
|
||||
TSPoint start_point = ts_node_start_point(*self);
|
||||
t_u32 start_byte = ts_node_start_byte(*self);
|
||||
TSPoint start_point = ts_node_start_point(*self);
|
||||
|
||||
if (start_byte >= edit->old_end_byte)
|
||||
{
|
||||
|
|
@ -882,7 +882,7 @@ void ts_node_edit(TSNode *self, const TSInputEdit *edit)
|
|||
self->context[2] = start_point.column;
|
||||
}
|
||||
|
||||
TSSymbol ts_node_field_id_for_child(TSNode self, uint32_t child_index)
|
||||
TSSymbol ts_node_field_id_for_child(TSNode self, t_u32 child_index)
|
||||
{
|
||||
const char *name = ts_node_field_name_for_child(self, child_index);
|
||||
if (name == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue