Updated to remove more usless stuff
This commit is contained in:
parent
5b7eb9784b
commit
db0903c3a8
31 changed files with 480 additions and 1058 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/28 18:36:40 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/08/02 12:17:33 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/08/22 15:58:43 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -16,15 +16,13 @@
|
|||
#include "parser/api.h"
|
||||
#include <stdio.h>
|
||||
|
||||
t_node build_node(t_parse_node current, t_const_str input);
|
||||
t_node build_node(t_parse_node current, t_const_str input);
|
||||
|
||||
t_language *tree_sitter_bash(void);
|
||||
|
||||
t_node *build_childs(t_parse_node parent, t_const_str input, t_usize count)
|
||||
t_node *build_childs(t_parse_node parent, t_const_str input, t_usize count)
|
||||
{
|
||||
t_node *ret;
|
||||
t_usize idx;
|
||||
t_parse_node child;
|
||||
t_node *ret;
|
||||
t_usize idx;
|
||||
t_parse_node child;
|
||||
|
||||
ret = mem_alloc_array(sizeof(*ret), count);
|
||||
if (ret == NULL)
|
||||
|
|
@ -34,19 +32,19 @@ t_node *build_childs(t_parse_node parent, t_const_str input, t_usize count)
|
|||
{
|
||||
child = ts_node_child(parent, idx);
|
||||
ret[idx] = build_node(child, input);
|
||||
ret[idx].field_str = ts_node_field_name_for_child(parent, idx);
|
||||
ret[idx].field = ts_node_field_id_for_child(parent, idx);
|
||||
ret[idx].field_str = ts_language_field_name_for_id(ts_node_language(parent), ret[idx].field);
|
||||
idx++;
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
||||
t_node build_node(t_parse_node curr, t_const_str input)
|
||||
t_node build_node(t_parse_node curr, t_const_str input)
|
||||
{
|
||||
t_node out;
|
||||
t_node out;
|
||||
|
||||
out.kind = ts_node_symbol(curr);
|
||||
out.kind_str = ts_node_type(curr);
|
||||
out.kind_str = ts_language_symbol_name(ts_node_language(curr), out.kind);
|
||||
out.start = ts_node_start_byte(curr);
|
||||
out.end = ts_node_end_byte(curr);
|
||||
out.input = input;
|
||||
|
|
@ -61,10 +59,10 @@ t_node build_node(t_parse_node curr, t_const_str input)
|
|||
return (out);
|
||||
}
|
||||
|
||||
t_str node_getstr(t_node *node)
|
||||
t_str node_getstr(t_node *node)
|
||||
{
|
||||
t_usize start;
|
||||
t_usize end;
|
||||
t_usize start;
|
||||
t_usize end;
|
||||
t_str ret;
|
||||
|
||||
if (node->single_str == NULL)
|
||||
|
|
@ -80,9 +78,9 @@ t_str node_getstr(t_node *node)
|
|||
return (node->single_str);
|
||||
}
|
||||
|
||||
void free_node(t_node self)
|
||||
void free_node(t_node self)
|
||||
{
|
||||
t_usize idx;
|
||||
t_usize idx;
|
||||
|
||||
if (self.single_str)
|
||||
mem_free(self.single_str);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue