Updates...

This commit is contained in:
Maix0 2024-05-01 21:19:14 +02:00
parent 43480c35e4
commit a192af9ad4
12 changed files with 1836 additions and 1787 deletions

View file

@ -12,7 +12,7 @@
#include "../includes/minishell.h"
void ts_parser_delete(TSParser *self);
void ts_parser_delete(t_first_parser *self);
void ft_free(void *ptr)
{

View file

@ -15,13 +15,13 @@
#include "me/string/str_len.h"
#include "parser/api.h"
TSParser *ts_parser_new();
void ts_tree_delete(TSTree *);
TSNode ts_tree_root_node(TSTree *);
TSTree *ts_parser_parse_string(TSParser *, TSTree *oldtree, t_const_str input,
t_first_parser *ts_parser_new();
void ts_tree_delete(t_first_tree *);
t_parse_node ts_tree_root_node(t_first_tree *);
t_first_tree *ts_parser_parse_string(t_first_parser *, t_first_tree *oldtree, t_const_str input,
t_usize len);
void ts_parser_delete(TSParser *self);
void ts_parser_set_language(TSParser *self, TSLanguage *lang);
void ts_parser_delete(t_first_parser *self);
void ts_parser_set_language(t_first_parser *self, t_language *lang);
void print_node_data(t_node *t, t_usize depth)
{
@ -36,10 +36,10 @@ void print_node_data(t_node *t, t_usize depth)
print_node_data(&t->childs[idx++], depth + 1);
}
t_node parse_to_nodes(TSParser *parser, t_const_str input)
t_node parse_to_nodes(t_first_parser *parser, t_const_str input)
{
TSTree *tree;
TSNode node;
t_first_tree *tree;
t_parse_node node;
t_node ret;
tree = ts_parser_parse_string(parser, NULL, input, str_len(input));
@ -112,12 +112,12 @@ void ft_find_path(t_str arge[], t_utils *utils)
utils->path = ft_split(PATH_FILES, ':');
}
TSLanguage *tree_sitter_bash(void);
t_language *tree_sitter_bash(void);
t_parser create_myparser(void)
{
TSLanguage *lang;
TSParser *parser;
t_language *lang;
t_first_parser *parser;
lang = tree_sitter_bash();
parser = ts_parser_new();

View file

@ -16,19 +16,19 @@
#include "me/string/str_l_copy.h"
#include "parser/api.h"
t_node build_node(TSNode current, t_const_str input);
TSNode ts_node_child(TSNode parent, t_usize idx);
TSSymbol ts_node_symbol(TSNode self);
t_const_str ts_node_type(TSNode self);
t_u32 ts_node_start_byte(TSNode self);
t_u32 ts_node_end_byte(TSNode self);
t_u32 ts_node_child_count(TSNode self);
t_node build_node(t_parse_node current, t_const_str input);
t_parse_node ts_node_child(t_parse_node parent, t_usize idx);
t_symbol ts_node_symbol(t_parse_node self);
t_const_str ts_node_type(t_parse_node self);
t_u32 ts_node_start_byte(t_parse_node self);
t_u32 ts_node_end_byte(t_parse_node self);
t_u32 ts_node_child_count(t_parse_node self);
t_node *build_childs(TSNode 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;
TSNode child;
t_parse_node child;
ret = mem_alloc_array(sizeof(*ret), count);
if (ret == NULL)
@ -43,7 +43,7 @@ t_node *build_childs(TSNode parent, t_const_str input, t_usize count)
return (ret);
}
t_node build_node(TSNode curr, t_const_str input)
t_node build_node(t_parse_node curr, t_const_str input)
{
t_node out;