--- /dev/null
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_get_node_child.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: ljiriste <ljiriste@student.42prague.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2024/11/28 15:19:13 by ljiriste #+# #+# */
+/* Updated: 2024/11/28 15:40:33 by ljiriste ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "ft_parse.h"
+#include "libft.h"
+
+t_parse_tree_node *ft_get_node_child(t_parse_tree_node *node, size_t index)
+{
+ return (ft_vec_access(&node->children, index));
+}
+
+const t_parse_tree_node *ft_cget_node_child(
+ const t_parse_tree_node *node, size_t index)
+{
+ return (ft_vec_caccess(&node->children, index));
+}
/* By: ljiriste <ljiriste@student.42prague.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/27 21:21:54 by ljiriste #+# #+# */
-/* Updated: 2024/11/28 11:46:05 by ljiriste ### ########.fr */
+/* Updated: 2024/11/28 16:29:33 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
//
// Tokens should not contain whitespace as it is used as separator
-t_ft_stat ft_parsing_table_init(t_parsing_table *table);
-t_ft_stat ft_parsing_table_load_name(t_parsing_table *table,
- const char *filename, const char *rules_filename);
-t_ft_stat ft_parsing_table_generate(t_parsing_table *table,
- const char *rules_filename);
-t_ft_stat ft_parsing_table_load_fd(t_parsing_table *table,
- int table_fd, int rules_fd);
-t_ft_stat ft_parsing_table_load_str(t_parsing_table *table,
- const char *table_str, const char *rules_str);
-t_parse_tree_node *ft_parse(const t_vec *tokens,
- const t_parsing_table *table);
-
-t_ft_stat ft_parsing_table_save(const t_parsing_table *table,
- const char *filename);
-
-void ft_parsing_table_print(t_parsing_table *table,
- unsigned int column_width);
-void ft_parse_tree_print(t_parse_tree_node *root);
-
-void ft_parse_tree_free(void *node);
-void ft_parsing_table_free(t_parsing_table *table);
+t_ft_stat ft_parsing_table_init(t_parsing_table *table);
+t_ft_stat ft_parsing_table_load_name(t_parsing_table *table,
+ const char *filename, const char *rules_filename);
+t_ft_stat ft_parsing_table_generate(t_parsing_table *table,
+ const char *rules_filename);
+t_ft_stat ft_parsing_table_load_fd(t_parsing_table *table,
+ int table_fd, int rules_fd);
+t_ft_stat ft_parsing_table_load_str(t_parsing_table *table,
+ const char *table_str, const char *rules_str);
+t_parse_tree_node *ft_parse(const t_vec *tokens,
+ const t_parsing_table *table);
+
+t_ft_stat ft_parsing_table_save(const t_parsing_table *table,
+ const char *filename);
+
+void ft_parsing_table_print(t_parsing_table *table,
+ unsigned int column_width);
+void ft_parse_tree_print(t_parse_tree_node *root);
+
+t_parse_tree_node *ft_get_node_child(t_parse_tree_node *node, size_t index);
+const t_parse_tree_node *ft_cget_node_child(
+ const t_parse_tree_node *node, size_t index);
+
+void ft_parse_tree_free(void *node);
+void ft_parsing_table_free(t_parsing_table *table);
#endif // FT_PARSE_H