update: normed lots of stuff

This commit is contained in:
maix0 2024-09-19 17:35:57 +02:00
parent 978636b6ef
commit 50a2f3d4be
118 changed files with 1145 additions and 1330 deletions

View file

@ -12,7 +12,7 @@
#include "parser/inner/node.h"
t_u32 ts_node_child_count(TSNode self)
t_u32 ts_node_child_count(t_node self)
{
t_subtree tree;
@ -23,7 +23,7 @@ t_u32 ts_node_child_count(TSNode self)
return (0);
}
t_u32 ts_node_named_child_count(TSNode self)
t_u32 ts_node_named_child_count(t_node self)
{
t_subtree tree;
@ -34,17 +34,17 @@ t_u32 ts_node_named_child_count(TSNode self)
return (0);
}
TSFieldId ts_node_field_id_for_child(TSNode self, t_u32 child_index)
t_field_id ts_node_field_id_for_child(t_node self, t_u32 child_index)
{
TSNode result;
t_node result;
bool did_descend;
TSFieldId inherited_field_id;
TSNode child;
t_field_id inherited_field_id;
t_node child;
t_u32 index;
NodeChildIterator iterator;
t_u32 grandchild_index;
t_u32 grandchild_count;
TSFieldId field_id;
t_field_id field_id;
result = self;
did_descend = true;

View file

@ -12,11 +12,11 @@
#include "parser/inner/node.h"
TSNode ts_node__child(TSNode self, t_u32 child_index, bool include_anonymous)
t_node ts_node__child(t_node self, t_u32 child_index, bool include_anonymous)
{
TSNode result;
t_node result;
bool did_descend;
TSNode child;
t_node child;
t_u32 index;
NodeChildIterator iterator;
t_u32 grandchild_index;

View file

@ -14,16 +14,16 @@
#include "parser/length.h"
#include "parser/subtree.h"
TSNode ts_node_new(const TSTree *tree, const t_subtree *subtree, \
Length position, TSSymbol alias)
t_node ts_node_new(const t_tree *tree, const t_subtree *subtree, \
t_length position, t_symbol alias)
{
return ((TSNode){
return ((t_node){
position.bytes, position.extent.row, position.extent.column, \
alias, subtree, tree,
});
}
TSNode ts_node__null(void)
t_node ts_node__null(void)
{
return (ts_node_new(NULL, NULL, length_zero(), 0));
}

View file

@ -15,7 +15,7 @@
#include "parser/language.h"
#include "parser/tree.h"
t_const_str ts_node__field_name_from_language(TSNode self,
t_const_str ts_node__field_name_from_language(t_node self,
t_u32 structural_child_index)
{
const TSFieldMapEntry *field_map;
@ -33,7 +33,7 @@ t_const_str ts_node__field_name_from_language(TSNode self,
return (NULL);
}
TSFieldId ts_node__field_id_from_language(TSNode self,
t_field_id ts_node__field_id_from_language(t_node self,
t_u32 structural_child_index)
{
const TSFieldMapEntry *field_map;

View file

@ -14,14 +14,14 @@
#include "parser/language.h"
#include "parser/tree.h"
bool ts_node_is_extra(TSNode self)
bool ts_node_is_extra(t_node self)
{
return (ts_subtree_extra(ts_node__subtree(self)));
}
bool ts_node_is_named(TSNode self)
bool ts_node_is_named(t_node self)
{
TSSymbol alias;
t_symbol alias;
alias = ts_node__alias(&self);
if (alias)
@ -29,12 +29,12 @@ bool ts_node_is_named(TSNode self)
return (ts_subtree_named(ts_node__subtree(self)));
}
TSNode ts_node_child(TSNode self, t_u32 child_index)
t_node ts_node_child(t_node self, t_u32 child_index)
{
return (ts_node__child(self, child_index, true));
}
TSNode ts_node_named_child(TSNode self, t_u32 child_index)
t_node ts_node_named_child(t_node self, t_u32 child_index)
{
return (ts_node__child(self, child_index, false));
}

View file

@ -14,27 +14,27 @@
#include "parser/language.h"
#include "parser/tree.h"
t_u32 ts_node_start_byte(TSNode self)
t_u32 ts_node_start_byte(t_node self)
{
return (self.start_byte);
}
const TSLanguage *ts_node_language(TSNode self)
const t_language *ts_node_language(t_node self)
{
return (self.tree->language);
}
TSPoint ts_node_start_point(TSNode self)
t_point ts_node_start_point(t_node self)
{
return ((TSPoint){self.start_row, self.start_col});
return ((t_point){self.start_row, self.start_col});
}
t_u32 ts_node__alias(const TSNode *self)
t_u32 ts_node__alias(const t_node *self)
{
return (self->alias);
}
t_subtree ts_node__subtree(TSNode self)
t_subtree ts_node__subtree(t_node self)
{
return (*(const t_subtree *)self.id);
}

View file

@ -14,15 +14,15 @@
#include "parser/language.h"
#include "parser/tree.h"
t_u32 ts_node_end_byte(TSNode self)
t_u32 ts_node_end_byte(t_node self)
{
return (ts_node_start_byte(self)
+ ts_subtree_size(ts_node__subtree(self)).bytes);
}
TSSymbol ts_node_symbol(TSNode self)
t_symbol ts_node_symbol(t_node self)
{
TSSymbol symbol;
t_symbol symbol;
symbol = ts_node__alias(&self);
if (!symbol)
@ -30,9 +30,9 @@ TSSymbol ts_node_symbol(TSNode self)
return (ts_language_public_symbol(self.tree->language, symbol));
}
t_const_str ts_node_type(TSNode self)
t_const_str ts_node_type(t_node self)
{
TSSymbol symbol;
t_symbol symbol;
symbol = ts_node__alias(&self);
if (!symbol)
@ -40,14 +40,14 @@ t_const_str ts_node_type(TSNode self)
return (ts_language_symbol_name(self.tree->language, symbol));
}
TSSymbol ts_node_grammar_symbol(TSNode self)
t_symbol ts_node_grammar_symbol(t_node self)
{
return (ts_subtree_symbol(ts_node__subtree(self)));
}
t_const_str ts_node_grammar_type(TSNode self)
t_const_str ts_node_grammar_type(t_node self)
{
TSSymbol symbol;
t_symbol symbol;
symbol = ts_subtree_symbol(ts_node__subtree(self));
return (ts_language_symbol_name(self.tree->language, symbol));

View file

@ -14,10 +14,10 @@
#include "parser/language.h"
#include "parser/tree.h"
NodeChildIterator ts_node_iterate_children(const TSNode *node)
NodeChildIterator ts_node_iterate_children(const t_node *node)
{
t_subtree subtree;
const TSSymbol *alias_sequence;
const t_symbol *alias_sequence;
subtree = ts_node__subtree(*node);
if (ts_subtree_child_count(subtree) == 0)
@ -40,10 +40,10 @@ bool ts_node_child_iterator_done(NodeChildIterator *self)
return (self->child_index == self->parent->child_count);
}
bool ts_node_child_iterator_next(NodeChildIterator *self, TSNode *result)
bool ts_node_child_iterator_next(NodeChildIterator *self, t_node *result)
{
const t_subtree *child;
TSSymbol alias_symbol;
t_symbol alias_symbol;
if (!self->parent || ts_node_child_iterator_done(self))
return (false);

View file

@ -14,9 +14,9 @@
#include "parser/language.h"
#include "parser/tree.h"
bool ts_node__is_relevant(TSNode self, bool include_anonymous)
bool ts_node__is_relevant(t_node self, bool include_anonymous)
{
TSSymbol alias;
t_symbol alias;
t_subtree tree;
tree = ts_node__subtree(self);
@ -29,7 +29,7 @@ bool ts_node__is_relevant(TSNode self, bool include_anonymous)
return (ts_subtree_visible(tree) && ts_subtree_named(tree));
}
t_u32 ts_node__relevant_child_count(TSNode self, bool include_anonymous)
t_u32 ts_node__relevant_child_count(t_node self, bool include_anonymous)
{
t_subtree tree;