/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/21 09:51:43 by ljiriste #+# #+# */
-/* Updated: 2024/06/21 10:33:09 by ljiriste ### ########.fr */
+/* Updated: 2024/06/21 11:07:45 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
{
size_t i;
+ if (!node)
+ {
+ ft_printf("%s\n", node);
+ return ;
+ }
i = 0;
while (i + 1 < node->children.size)
{
static void print_last_at_depth(t_parse_tree_node *node, size_t depth, char branches[MAX_WIDTH])
{
+ if (!node)
+ {
+ ft_printf("%s\n", node);
+ return ;
+ }
ft_printf("%s-%s\n", branches, node->token.type);
branches[ft_strlen(branches) - 1] = ' ';
ft_strlcat(branches, " |", MAX_WIDTH);
static void print_node_at_depth(t_parse_tree_node *node, size_t depth, char branches[MAX_WIDTH])
{
+ if (!node)
+ {
+ ft_printf("%s\n", node);
+ return ;
+ }
if (depth == 0)
{
ft_printf("%s\n", node->token.type);