update: normed ast
This commit is contained in:
parent
0c81df4b0a
commit
d36fea0c95
13 changed files with 368 additions and 337 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/06 18:43:35 by rparodi #+# #+# */
|
||||
/* Updated: 2024/09/02 17:32:38 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/09/13 14:38:32 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -43,13 +43,15 @@ t_error build_sym_for_statement(\
|
|||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
|
||||
(void)(out);
|
||||
if (out == NULL || ts_node_symbol(self) != sym_for_statement)
|
||||
return (ERROR);
|
||||
return (ERROR);
|
||||
(void)(i);
|
||||
(void)(ret);
|
||||
(void)(tmp);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_for_statement)
|
||||
return (ERROR);
|
||||
}
|
||||
/*
|
||||
ret = ast_alloc(AST_FOR);
|
||||
i = 0;
|
||||
while (i < ts_node_child_count(self))
|
||||
|
|
@ -57,10 +59,8 @@ t_error build_sym_for_statement(\
|
|||
if (!ts_node_is_named(ts_node_child(self, i)) && (i++, true))
|
||||
continue ;
|
||||
if (ts_node_field_id_for_child(self, i) == field_var)
|
||||
{
|
||||
ret->data.for_.var_name = \
|
||||
_extract_str(ts_node_child(self, i), input);
|
||||
}
|
||||
if (ts_node_field_id_for_child(self, i) == field_value)
|
||||
{
|
||||
if (ast_from_node(ts_node_child(self, i), input, &tmp))
|
||||
|
|
@ -77,6 +77,7 @@ t_error build_sym_for_statement(\
|
|||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
*/
|
||||
|
||||
t_error build_sym_while_statement(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
|
|
@ -87,13 +88,17 @@ t_error build_sym_while_statement(\
|
|||
t_parse_node child;
|
||||
t_ast_terminator_kind term;
|
||||
|
||||
(void)(out);
|
||||
if (out == NULL || ts_node_symbol(self) != sym_while_statement)
|
||||
return (ERROR);
|
||||
return (ERROR);
|
||||
(void)(child);
|
||||
(void)(i);
|
||||
(void)(ret);
|
||||
(void)(term);
|
||||
(void)(tmp);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_while_statement)
|
||||
return (ERROR);
|
||||
}
|
||||
/*
|
||||
i = 0;
|
||||
if (ts_node_symbol(ts_node_child(self, 0)) == anon_sym_until)
|
||||
ret = ast_alloc(AST_UNTIL);
|
||||
|
|
@ -125,6 +130,7 @@ t_error build_sym_while_statement(\
|
|||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
*/
|
||||
|
||||
t_error build_sym_do_group(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
|
|
@ -134,13 +140,16 @@ t_error build_sym_do_group(\
|
|||
t_usize i;
|
||||
t_ast_terminator_kind term;
|
||||
|
||||
(void)(out);
|
||||
if (out == NULL || ts_node_symbol(self) != sym_do_group)
|
||||
return (ERROR);
|
||||
return (ERROR);
|
||||
(void)(i);
|
||||
(void)(ret);
|
||||
(void)(term);
|
||||
(void)(tmp);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_do_group)
|
||||
return (ERROR);
|
||||
}
|
||||
/*
|
||||
ret = ast_alloc(AST_COMPOUND_STATEMENT);
|
||||
i = 0;
|
||||
while (i < ts_node_child_count(self))
|
||||
|
|
@ -168,3 +177,4 @@ t_error build_sym_do_group(\
|
|||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/06 18:36:09 by rparodi #+# #+# */
|
||||
/* Updated: 2024/08/06 18:58:01 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/09/13 15:09:40 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -50,14 +50,17 @@ void ast_set_term(t_ast_node *node, t_ast_terminator_kind term)
|
|||
t_error build_sym_if_statement(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
(void)(self);
|
||||
(void)(input);
|
||||
(void)(out);
|
||||
return (ERROR);
|
||||
}
|
||||
/*
|
||||
t_parse_node child;
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
|
||||
(void)(out);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_if_statement)
|
||||
|
|
@ -96,10 +99,17 @@ t_error build_sym_if_statement(\
|
|||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
*/
|
||||
|
||||
t_error build_sym_elif_clause(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
(void)(self);
|
||||
(void)(input);
|
||||
(void)(out);
|
||||
return (ERROR);
|
||||
}
|
||||
/*
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
|
|
@ -134,10 +144,17 @@ t_error build_sym_elif_clause(\
|
|||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
*/
|
||||
|
||||
t_error build_sym_else_clause(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
(void)(self);
|
||||
(void)(input);
|
||||
(void)(out);
|
||||
return (ERROR);
|
||||
}
|
||||
/*
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
|
|
@ -166,3 +183,4 @@ t_error build_sym_else_clause(\
|
|||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/09 15:07:10 by rparodi #+# #+# */
|
||||
/* Updated: 2024/09/02 11:35:32 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/09/13 14:30:59 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -44,16 +44,10 @@ t_error build_sym_pipeline(\
|
|||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_ast_node tmp2;
|
||||
t_ast_node t[2];
|
||||
t_usize i;
|
||||
|
||||
(void)(out);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_pipeline)
|
||||
if (out == NULL || ts_node_symbol(self) != sym_pipeline)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_PIPELINE);
|
||||
i = 0;
|
||||
|
|
@ -61,16 +55,16 @@ t_error build_sym_pipeline(\
|
|||
{
|
||||
if (!ts_node_is_named(ts_node_child(self, i)) && (i++, true))
|
||||
continue ;
|
||||
if (ast_from_node(ts_node_child(self, i), input, &tmp))
|
||||
if (ast_from_node(ts_node_child(self, i), input, &t[0]))
|
||||
return (ast_free(ret), ERROR);
|
||||
if (tmp->kind == AST_PIPELINE)
|
||||
if (t[0]->kind == AST_PIPELINE)
|
||||
{
|
||||
while (!vec_ast_pop_front(&tmp->data.pipeline.statements, &tmp2))
|
||||
vec_ast_push(&ret->data.pipeline.statements, tmp2);
|
||||
ast_free(tmp);
|
||||
while (!vec_ast_pop_front(&t[0]->data.pipeline.statements, &t[1]))
|
||||
vec_ast_push(&ret->data.pipeline.statements, t[1]);
|
||||
ast_free(t[0]);
|
||||
}
|
||||
else
|
||||
vec_ast_push(&ret->data.pipeline.statements, tmp);
|
||||
vec_ast_push(&ret->data.pipeline.statements, t[0]);
|
||||
i++;
|
||||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/02 17:33:20 by rparodi #+# #+# */
|
||||
/* Updated: 2024/09/02 17:33:41 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/09/13 15:25:45 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -20,25 +20,7 @@
|
|||
#include "parser/api.h"
|
||||
#include <stdio.h>
|
||||
|
||||
t_error build_sym_compound_statement(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
t_ast_terminator_kind term;
|
||||
|
||||
(void)(out);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_compound_statement)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_COMPOUND_STATEMENT);
|
||||
i = 0;
|
||||
while (i < ts_node_child_count(self))
|
||||
{
|
||||
/*
|
||||
if (ts_node_field_id_for_child(self, i) == field_term && \
|
||||
ret->data.compound_statement.body.len != 0)
|
||||
{
|
||||
|
|
@ -47,6 +29,21 @@ t_error build_sym_compound_statement(\
|
|||
ret->data.compound_statement.body.len - 1], term);
|
||||
}
|
||||
else
|
||||
*/
|
||||
|
||||
t_error build_sym_compound_statement(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
|
||||
if (out == NULL || ts_node_symbol(self) != sym_compound_statement)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_COMPOUND_STATEMENT);
|
||||
i = 0;
|
||||
while (i < ts_node_child_count(self))
|
||||
{
|
||||
{
|
||||
if (!ts_node_is_named(ts_node_child(self, i)) && (i++, true))
|
||||
continue ;
|
||||
|
|
@ -58,6 +55,15 @@ t_error build_sym_compound_statement(\
|
|||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
/*
|
||||
if (ts_node_field_id_for_child(self, i) == field_term)
|
||||
{
|
||||
if (ret->data.program.body.len == 0 && (i++, true))
|
||||
continue ;
|
||||
ast_set_term(&ret->data.program.body.buffer[\
|
||||
ret->data.program.body.len - 1], _select_term(ts_node_child(self, i)));
|
||||
}
|
||||
*/
|
||||
|
||||
t_error build_sym_program(t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
|
|
@ -65,9 +71,7 @@ t_error build_sym_program(t_parse_node self, t_const_str input, t_ast_node *out)
|
|||
t_usize i;
|
||||
t_ast_node temp;
|
||||
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_program)
|
||||
if (out == NULL || ts_node_symbol(self) != sym_program)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_PROGRAM);
|
||||
i = 0;
|
||||
|
|
@ -80,14 +84,6 @@ t_error build_sym_program(t_parse_node self, t_const_str input, t_ast_node *out)
|
|||
return (ast_free(ret), ERROR);
|
||||
vec_ast_push(&ret->data.program.body, temp);
|
||||
}
|
||||
if (ts_node_field_id_for_child(self, i) == field_term)
|
||||
{
|
||||
if (ret->data.program.body.len == 0 && (i++, true))
|
||||
continue ;
|
||||
ast_set_term(&ret->data.program.body.buffer[\
|
||||
ret->data.program.body.len - 1], \
|
||||
_select_term(ts_node_child(self, i)));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/06 18:26:15 by rparodi #+# #+# */
|
||||
/* Updated: 2024/09/02 17:34:28 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/09/13 14:56:19 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -22,14 +22,16 @@
|
|||
#include "parser/api.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void _build_sym_command_substitution_inner(\
|
||||
t_parse_node self, t_const_str input, t_ast_node ret, t_usize i);
|
||||
void _build_sym_expansion_inner(\
|
||||
t_parse_node self, t_const_str input, t_ast_node ret, t_usize i);
|
||||
|
||||
t_error build_sym_regex(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
t_ast_node ret;
|
||||
|
||||
(void)(out);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_regex)
|
||||
|
|
@ -44,9 +46,6 @@ t_error build_sym_extglob_pattern(\
|
|||
{
|
||||
t_ast_node ret;
|
||||
|
||||
(void)(out);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_extglob_pattern)
|
||||
|
|
@ -63,12 +62,7 @@ t_error build_sym_expansion(\
|
|||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
|
||||
(void)(out);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_expansion)
|
||||
if (out == NULL || ts_node_symbol(self) != sym_expansion)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_EXPANSION);
|
||||
ret->data.expansion.kind = E_OP_NONE;
|
||||
|
|
@ -77,13 +71,7 @@ t_error build_sym_expansion(\
|
|||
{
|
||||
if (!ts_node_is_named(ts_node_child(self, i)) && (i++, true))
|
||||
continue ;
|
||||
if (ts_node_field_id_for_child(self, i) == field_len)
|
||||
ret->data.expansion.len_operator = true;
|
||||
if (ts_node_field_id_for_child(self, i) == field_name)
|
||||
ret->data.expansion.var_name = \
|
||||
_extract_str(ts_node_child(self, i), input);
|
||||
if (ts_node_field_id_for_child(self, i) == field_op)
|
||||
ret->data.expansion.kind = _extract_exp_op(ts_node_child(self, i));
|
||||
_build_sym_expansion_inner(self, input, ret, i);
|
||||
if (ts_node_field_id_for_child(self, i) == field_args)
|
||||
{
|
||||
if (ast_from_node(ts_node_child(self, i), input, &tmp))
|
||||
|
|
@ -101,12 +89,7 @@ t_error build_sym_simple_expansion(\
|
|||
t_ast_node ret;
|
||||
t_usize i;
|
||||
|
||||
(void)(out);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_simple_expansion)
|
||||
if (out == NULL || ts_node_symbol(self) != sym_simple_expansion)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_EXPANSION);
|
||||
ret->data.expansion.kind = E_OP_NONE;
|
||||
|
|
@ -129,9 +112,7 @@ t_error build_sym_command_substitution(\
|
|||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_command_substitution)
|
||||
if ((out == NULL) || ts_node_symbol(self) != sym_command_substitution)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_COMMAND_SUBSTITUTION);
|
||||
i = 0;
|
||||
|
|
@ -140,12 +121,7 @@ t_error build_sym_command_substitution(\
|
|||
if (!ts_node_is_named(ts_node_child(self, i)) && (i++, true))
|
||||
continue ;
|
||||
if (ts_node_symbol(ts_node_child(self, i)) == field_term)
|
||||
{
|
||||
if (ret->data.command_substitution.body.len != 0)
|
||||
ast_set_term(&ret->data.command_substitution.body.buffer[\
|
||||
ret->data.command_substitution.body.len - 1], \
|
||||
_select_term(ts_node_child(self, i)));
|
||||
}
|
||||
_build_sym_command_substitution_inner(self, input, ret, i);
|
||||
else
|
||||
{
|
||||
if (ast_from_node(ts_node_child(self, i), input, &tmp))
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/26 10:55:52 by rparodi #+# #+# */
|
||||
/* Updated: 2024/09/06 11:02:57 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/09/13 15:29:07 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -20,191 +20,11 @@
|
|||
#include "parser/api.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
E_OP_NONE = 0, // ${var}
|
||||
E_OP_DEFAULT, // ${var-word}
|
||||
E_OP_ASSIGN_DEFAULT, // ${var=word}
|
||||
E_OP_ERROR, // ${var?word}
|
||||
E_OP_ALTERNATE, // ${var+word}
|
||||
E_OP_DEFAULT_COLON, // ${var:-word}
|
||||
E_OP_ASSIGN_DEFAULT_COLON, // ${var:=word}
|
||||
E_OP_ERROR_COLON, // ${var:?word}
|
||||
E_OP_ALTERNATE_COLON, // ${var:+word}
|
||||
E_OP_LENGTH, // ${#var}
|
||||
E_OP_SMALLEST_PREFIX, // ${var#pattern}
|
||||
E_OP_LARGEST_PREFIX, // ${var##pattern}
|
||||
E_OP_SMALLEST_SUFFIX, // ${var%pattern}
|
||||
E_OP_LARGEST_SUFFIX, // ${var%%pattern}
|
||||
*/
|
||||
|
||||
/*
|
||||
if (symbol == anon_sym_LT_LT_DASH)
|
||||
return (AST_REDIR_HEREDOC_INDENT);
|
||||
if (symbol == anon_sym_LT_AMP)
|
||||
return (AST_REDIR_DUP_INPUT);
|
||||
if (symbol == anon_sym_GT_AMP)
|
||||
return (AST_REDIR_DUP_OUTPUT);
|
||||
if (symbol == anon_sym_GT_PIPE)
|
||||
return (AST_REDIR_OUTPUT_CLOBBER);
|
||||
if (symbol == anon_sym_LT_GT)
|
||||
return (AST_REDIR_INPUT_OUTPUT);
|
||||
*/
|
||||
// RAPH
|
||||
|
||||
t_error ast_from_node(t_parse_node node, t_const_str input, t_ast_node *out);
|
||||
|
||||
/* FUNCTION THAT ARE DONE */
|
||||
|
||||
/* FUNCTION THAT ARE NOT DONE */
|
||||
|
||||
// RAPH
|
||||
// PLUS RAPH
|
||||
|
||||
/* if (ts_node_field_id_for_child(self, i) == field_fd) */
|
||||
/* { */
|
||||
/* if (ast_from_node(ts_node_child(self, i), input, &tmp)) */
|
||||
/* return (ast_free(ret), ERROR); */
|
||||
/* ret->data.file_redirection.input = tmp; */
|
||||
/* } */
|
||||
|
||||
t_error build_sym_subshell(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
t_ast_terminator_kind term;
|
||||
|
||||
(void)(out);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_subshell)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_SUBSHELL);
|
||||
i = 0;
|
||||
while (i < ts_node_child_count(self))
|
||||
{
|
||||
if (ts_node_field_id_for_child(self, i) == field_term && \
|
||||
ret->data.subshell.body.len != 0)
|
||||
{
|
||||
term = _select_term(ts_node_child(self, i));
|
||||
ast_set_term(&ret->data.subshell.body.buffer[\
|
||||
ret->data.subshell.body.len - 1], term);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ts_node_is_named(ts_node_child(self, i)) && (i++, true))
|
||||
continue ;
|
||||
if (ast_from_node(ts_node_child(self, i), input, &tmp))
|
||||
return (ast_free(ret), ERROR);
|
||||
vec_ast_push(&ret->data.subshell.body, tmp);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
|
||||
// t_error buildw
|
||||
|
||||
t_error build_sym_list(t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
t_ast_node ret;
|
||||
t_ast_node *output;
|
||||
t_usize i;
|
||||
t_symbol temp;
|
||||
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_LIST);
|
||||
i = 0;
|
||||
output = &ret->data.list.left;
|
||||
while (i < ts_node_child_count(self))
|
||||
{
|
||||
if (ts_node_field_id_for_child(self, i) == field_cmd)
|
||||
{
|
||||
if (ast_from_node(ts_node_child(self, i), input, output))
|
||||
return (ast_free(ret), ERROR);
|
||||
}
|
||||
else if (ts_node_field_id_for_child(self, i) == field_op)
|
||||
{
|
||||
temp = ts_node_grammar_symbol(ts_node_child(self, i));
|
||||
if (temp == anon_sym_PIPE_PIPE)
|
||||
ret->data.list.op = AST_LIST_OR;
|
||||
if (temp == anon_sym_AMP_AMP)
|
||||
ret->data.list.op = AST_LIST_AND;
|
||||
output = &ret->data.list.right;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
|
||||
t_error ast_from_node(\
|
||||
t_error _from_node_inner3(\
|
||||
t_parse_node node, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(node) == sym_arithmetic_binary_expression)
|
||||
return (build_sym_arithmetic_binary_expression(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_arithmetic_expansion)
|
||||
return (build_sym_arithmetic_expansion(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_arithmetic_literal)
|
||||
return (build_sym_arithmetic_literal(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_arithmetic_parenthesized_expression)
|
||||
return (build_sym_arithmetic_parenthesized_expression(\
|
||||
node, input, out));
|
||||
if (ts_node_symbol(node) == sym_arithmetic_postfix_expression)
|
||||
return (build_sym_arithmetic_postfix_expression(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_arithmetic_ternary_expression)
|
||||
return (build_sym_arithmetic_ternary_expression(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_arithmetic_unary_expression)
|
||||
return (build_sym_arithmetic_unary_expression(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_case_item)
|
||||
return (build_sym_case_item(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_case_statement)
|
||||
return (build_sym_case_statement(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_command)
|
||||
return (build_sym_command(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_command_name)
|
||||
return (build_sym_command_name(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_command_substitution)
|
||||
return (build_sym_command_substitution(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_comment)
|
||||
return (build_sym_comment(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_compound_statement)
|
||||
return (build_sym_compound_statement(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_concatenation)
|
||||
return (build_sym_concatenation(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_do_group)
|
||||
return (build_sym_do_group(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_elif_clause)
|
||||
return (build_sym_elif_clause(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_else_clause)
|
||||
return (build_sym_else_clause(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_expansion)
|
||||
return (build_sym_expansion(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_extglob_pattern)
|
||||
return (build_sym_extglob_pattern(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_file_descriptor)
|
||||
return (build_sym_file_descriptor(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_file_redirect)
|
||||
return (build_sym_file_redirect(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_for_statement)
|
||||
return (build_sym_for_statement(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_function_definition)
|
||||
return (build_sym_function_definition(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_heredoc_redirect)
|
||||
return (build_sym_heredoc_redirect(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_if_statement)
|
||||
return (build_sym_if_statement(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_list)
|
||||
return (build_sym_list(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_negated_command)
|
||||
return (build_sym_negated_command(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_number)
|
||||
return (build_sym_number(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_pipeline)
|
||||
return (build_sym_pipeline(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_program)
|
||||
|
|
@ -229,6 +49,84 @@ t_error ast_from_node(\
|
|||
return (build_sym_while_statement(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_word)
|
||||
return (build_sym_word(node, input, out));
|
||||
printf("UNKNOWN KIND = [%d]%s\n", ts_node_symbol(node), ts_node_type(node));
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
t_error _from_node_inner2(\
|
||||
t_parse_node node, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
if (ts_node_symbol(node) == sym_extglob_pattern)
|
||||
return (build_sym_extglob_pattern(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_file_descriptor)
|
||||
return (build_sym_file_descriptor(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_file_redirect)
|
||||
return (build_sym_file_redirect(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_for_statement)
|
||||
return (build_sym_for_statement(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_function_definition)
|
||||
return (build_sym_function_definition(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_heredoc_redirect)
|
||||
return (build_sym_heredoc_redirect(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_if_statement)
|
||||
return (build_sym_if_statement(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_list)
|
||||
return (build_sym_list(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_negated_command)
|
||||
return (build_sym_negated_command(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_number)
|
||||
return (build_sym_number(node, input, out));
|
||||
return (_from_node_inner3(node, input, out));
|
||||
}
|
||||
|
||||
t_error _from_node_inner(\
|
||||
t_parse_node node, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
if (ts_node_symbol(node) == sym_command)
|
||||
return (build_sym_command(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_command_name)
|
||||
return (build_sym_command_name(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_command_substitution)
|
||||
return (build_sym_command_substitution(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_comment)
|
||||
return (build_sym_comment(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_compound_statement)
|
||||
return (build_sym_compound_statement(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_concatenation)
|
||||
return (build_sym_concatenation(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_do_group)
|
||||
return (build_sym_do_group(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_elif_clause)
|
||||
return (build_sym_elif_clause(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_else_clause)
|
||||
return (build_sym_else_clause(node, input, out));
|
||||
if (ts_node_symbol(node) == sym_expansion)
|
||||
return (build_sym_expansion(node, input, out));
|
||||
return (_from_node_inner2(node, input, out));
|
||||
}
|
||||
|
||||
t_error ast_from_node(\
|
||||
t_parse_node node, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(node) == sym_arithmetic_binary_expression)
|
||||
return (build_sym_arithmetic_binary_expression(node, input, out));
|
||||
else if (ts_node_symbol(node) == sym_arithmetic_expansion)
|
||||
return (build_sym_arithmetic_expansion(node, input, out));
|
||||
else if (ts_node_symbol(node) == sym_arithmetic_literal)
|
||||
return (build_sym_arithmetic_literal(node, input, out));
|
||||
else if (ts_node_symbol(node) == sym_arithmetic_parenthesized_expression)
|
||||
return (build_sym_arithmetic_parenthesized_expression(\
|
||||
node, input, out));
|
||||
else if (ts_node_symbol(node) == sym_arithmetic_postfix_expression)
|
||||
return (build_sym_arithmetic_postfix_expression(node, input, out));
|
||||
else if (ts_node_symbol(node) == sym_arithmetic_ternary_expression)
|
||||
return (build_sym_arithmetic_ternary_expression(node, input, out));
|
||||
else if (ts_node_symbol(node) == sym_arithmetic_unary_expression)
|
||||
return (build_sym_arithmetic_unary_expression(node, input, out));
|
||||
else if (ts_node_symbol(node) == sym_case_item)
|
||||
return (build_sym_case_item(node, input, out));
|
||||
else if (ts_node_symbol(node) == sym_case_statement)
|
||||
return (build_sym_case_statement(node, input, out));
|
||||
return (_from_node_inner(node, input, out));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/06 18:27:48 by rparodi #+# #+# */
|
||||
/* Updated: 2024/09/02 17:04:40 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/09/13 14:42:25 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -20,6 +20,20 @@
|
|||
#include "parser/api.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void _append_redirection_single(t_ast_node node, t_vec_ast **vec)
|
||||
{
|
||||
if (node->kind == AST_CASE)
|
||||
*vec = &node->data.case_.suffixes_redirections;
|
||||
else if (node->kind == AST_COMMAND)
|
||||
*vec = &node->data.command.suffixes_redirections;
|
||||
else if (node->kind == AST_COMPOUND_STATEMENT)
|
||||
*vec = &node->data.compound_statement.suffixes_redirections;
|
||||
else if (node->kind == AST_SUBSHELL)
|
||||
*vec = &node->data.subshell.suffixes_redirections;
|
||||
else
|
||||
*vec = _append_scripting(node);
|
||||
}
|
||||
|
||||
void _append_redirection(t_ast_node node, t_ast_node redirection)
|
||||
{
|
||||
t_vec_ast *vec;
|
||||
|
|
@ -29,12 +43,6 @@ void _append_redirection(t_ast_node node, t_ast_node redirection)
|
|||
!(redirection->kind == AST_FILE_REDIRECTION || \
|
||||
redirection->kind == AST_HEREDOC_REDIRECTION))
|
||||
return (ast_free(redirection));
|
||||
if (node->kind == AST_CASE)
|
||||
vec = &node->data.case_.suffixes_redirections;
|
||||
else if (node->kind == AST_COMMAND)
|
||||
vec = &node->data.command.suffixes_redirections;
|
||||
else if (node->kind == AST_COMPOUND_STATEMENT)
|
||||
vec = &node->data.compound_statement.suffixes_redirections;
|
||||
else if (node->kind == AST_LIST)
|
||||
return (_append_redirection(\
|
||||
node->data.list.right, redirection));
|
||||
|
|
@ -42,10 +50,8 @@ void _append_redirection(t_ast_node node, t_ast_node redirection)
|
|||
node->data.pipeline.statements.len != 0)
|
||||
return (_append_redirection(node->data.pipeline.statements.buffer[\
|
||||
node->data.pipeline.statements.len - 1], redirection));
|
||||
else if (node->kind == AST_SUBSHELL)
|
||||
vec = &node->data.subshell.suffixes_redirections;
|
||||
else
|
||||
vec = _append_scripting(node);
|
||||
_append_redirection_single(node, &vec);
|
||||
if (vec != NULL)
|
||||
vec_ast_push(vec, redirection);
|
||||
else
|
||||
|
|
|
|||
40
ast/src/from_node/node_utils3.c
Normal file
40
ast/src/from_node/node_utils3.c
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* node_utils3.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/13 14:54:21 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/09/13 14:57:34 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ast/_from_node.h"
|
||||
#include "ast/ast.h"
|
||||
#include "gmr/field_identifiers.h"
|
||||
#include "me/types.h"
|
||||
#include "me/vec/vec_ast.h"
|
||||
#include "parser/api.h"
|
||||
|
||||
void _build_sym_expansion_inner(\
|
||||
t_parse_node self, t_const_str input, t_ast_node ret, t_usize i)
|
||||
{
|
||||
if (ts_node_field_id_for_child(self, i) == field_len)
|
||||
ret->data.expansion.len_operator = true;
|
||||
if (ts_node_field_id_for_child(self, i) == field_name)
|
||||
ret->data.expansion.var_name = \
|
||||
_extract_str(ts_node_child(self, i), input);
|
||||
if (ts_node_field_id_for_child(self, i) == field_op)
|
||||
ret->data.expansion.kind = _extract_exp_op(ts_node_child(self, i));
|
||||
}
|
||||
|
||||
void _build_sym_command_substitution_inner(\
|
||||
t_parse_node self, t_const_str input, t_ast_node ret, t_usize i)
|
||||
{
|
||||
(void)(input);
|
||||
if (ret->data.command_substitution.body.len != 0)
|
||||
ast_set_term(&ret->data.command_substitution.body.buffer[\
|
||||
ret->data.command_substitution.body.len - 1], \
|
||||
_select_term(ts_node_child(self, i)));
|
||||
}
|
||||
78
ast/src/from_node/other_node.c
Normal file
78
ast/src/from_node/other_node.c
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* other_node.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/13 15:03:03 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/09/13 15:26:05 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ast/ast.h"
|
||||
#include "gmr/symbols.h"
|
||||
#include "gmr/field_identifiers.h"
|
||||
#include "parser/api.h"
|
||||
#include "ast/_from_node.h"
|
||||
|
||||
static void _set_op_list(\
|
||||
t_parse_node self, t_ast_node **output, t_ast_node ret, t_usize i)
|
||||
{
|
||||
t_symbol temp;
|
||||
|
||||
temp = ts_node_grammar_symbol(ts_node_child(self, i));
|
||||
if (temp == anon_sym_PIPE_PIPE)
|
||||
ret->data.list.op = AST_LIST_OR;
|
||||
if (temp == anon_sym_AMP_AMP)
|
||||
ret->data.list.op = AST_LIST_AND;
|
||||
*output = &ret->data.list.right;
|
||||
}
|
||||
|
||||
t_error build_sym_list(t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
t_ast_node ret;
|
||||
t_ast_node *output;
|
||||
t_usize i;
|
||||
|
||||
if (out == NULL || ts_node_symbol(self) == sym_list)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_LIST);
|
||||
i = 0;
|
||||
output = &ret->data.list.left;
|
||||
while (i < ts_node_child_count(self))
|
||||
{
|
||||
if (ts_node_field_id_for_child(self, i) == field_cmd)
|
||||
{
|
||||
if (ast_from_node(ts_node_child(self, i), input, output))
|
||||
return (ast_free(ret), ERROR);
|
||||
}
|
||||
else if (ts_node_field_id_for_child(self, i) == field_op)
|
||||
_set_op_list(self, &output, ret, i);
|
||||
i++;
|
||||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
|
||||
t_error build_sym_subshell(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
|
||||
if (out == NULL || ts_node_symbol(self) != sym_subshell)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_SUBSHELL);
|
||||
i = 0;
|
||||
while (i < ts_node_child_count(self))
|
||||
{
|
||||
if (!ts_node_is_named(ts_node_child(self, i)) && (i++, true))
|
||||
continue ;
|
||||
if (ast_from_node(ts_node_child(self, i), input, &tmp))
|
||||
return (ast_free(ret), ERROR);
|
||||
vec_ast_push(&ret->data.subshell.body, tmp);
|
||||
i++;
|
||||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/06 18:45:21 by rparodi #+# #+# */
|
||||
/* Updated: 2024/08/09 14:38:26 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/09/13 14:37:44 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -25,18 +25,12 @@
|
|||
t_error build_sym_file_redirect(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_ast_node n[2];
|
||||
t_usize i;
|
||||
|
||||
(void)(out);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
if (out == NULL || ts_node_symbol(self) != sym_file_redirect)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_file_redirect)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_FILE_REDIRECTION);
|
||||
n[0] = ast_alloc(AST_FILE_REDIRECTION);
|
||||
i = 0;
|
||||
while (i < ts_node_child_count(self))
|
||||
{
|
||||
|
|
@ -44,38 +38,31 @@ t_error build_sym_file_redirect(\
|
|||
continue ;
|
||||
if (ts_node_field_id_for_child(self, i) == field_op)
|
||||
{
|
||||
ret->data.file_redirection.op = \
|
||||
n[0]->data.file_redirection.op = \
|
||||
_get_redirection_op(ts_node_child(self, i));
|
||||
}
|
||||
if (ts_node_field_id_for_child(self, i) == field_dest)
|
||||
{
|
||||
if (ast_from_node(ts_node_child(self, i), input, &tmp))
|
||||
return (ast_free(ret), ERROR);
|
||||
ret->data.file_redirection.output = tmp;
|
||||
if (ast_from_node(ts_node_child(self, i), input, &n[1]))
|
||||
return (ast_free(n[0]), ERROR);
|
||||
n[0]->data.file_redirection.output = n[1];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
return (*out = n[0], NO_ERROR);
|
||||
}
|
||||
|
||||
t_error build_sym_redirected_statement(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
t_ast_node ret_tmp;
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_ast_node n[3];
|
||||
t_usize i;
|
||||
|
||||
(void)(out);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_redirected_statement)
|
||||
if (out == NULL || ts_node_symbol(self) != sym_redirected_statement)
|
||||
return (ERROR);
|
||||
i = 0;
|
||||
ret = ast_alloc(AST_COMMAND);
|
||||
ret_tmp = ret;
|
||||
n[1] = ast_alloc(AST_COMMAND);
|
||||
n[0] = n[1];
|
||||
while (i < ts_node_child_count(self))
|
||||
{
|
||||
if (!ts_node_is_named(ts_node_child(self, i)) && (i++, true))
|
||||
|
|
@ -83,15 +70,14 @@ t_error build_sym_redirected_statement(\
|
|||
if (!(ts_node_symbol(ts_node_child(self, i)) == sym_file_redirect || \
|
||||
ts_node_symbol(ts_node_child(self, i)) == sym_heredoc_redirect))
|
||||
{
|
||||
if (ast_from_node(ts_node_child(self, i++), input, &ret))
|
||||
return (ast_free(ret_tmp), ERROR);
|
||||
if (ast_from_node(ts_node_child(self, i++), input, &n[1]))
|
||||
return (ast_free(n[0]), ERROR);
|
||||
continue ;
|
||||
}
|
||||
if (ast_from_node(ts_node_child(self, i++), input, &tmp))
|
||||
return ((void)((ret != ret_tmp) \
|
||||
&& (ast_free(ret_tmp), true)), ast_free(ret), ERROR);
|
||||
_append_redirection(ret, tmp);
|
||||
if (ast_from_node(ts_node_child(self, i++), input, &n[2]))
|
||||
return ((void)((n[1] != n[0]) \
|
||||
&& (ast_free(n[0]), true)), ast_free(n[1]), ERROR);
|
||||
_append_redirection(n[1], n[2]);
|
||||
}
|
||||
return ((void)((ret != ret_tmp) \
|
||||
&& (ast_free(ret_tmp), true)), *out = ret, NO_ERROR);
|
||||
return ((void)(n[1] != n[0] && (ast_free(n[0]), true)), *out = n[1], 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/06 18:34:12 by rparodi #+# #+# */
|
||||
/* Updated: 2024/08/09 14:42:13 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/09/13 15:10:16 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -25,6 +25,12 @@
|
|||
t_error build_sym_function_definition(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
(void)(self);
|
||||
(void)(input);
|
||||
(void)(out);
|
||||
return (ERROR);
|
||||
}
|
||||
/*
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
|
|
@ -55,10 +61,17 @@ t_error build_sym_function_definition(\
|
|||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
*/
|
||||
|
||||
t_error build_sym_case_statement(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
(void)(self);
|
||||
(void)(input);
|
||||
(void)(out);
|
||||
return (ERROR);
|
||||
}
|
||||
/*
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
|
|
@ -90,10 +103,17 @@ t_error build_sym_case_statement(\
|
|||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
*/
|
||||
|
||||
t_error build_sym__case_item_last(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
(void)(self);
|
||||
(void)(input);
|
||||
(void)(out);
|
||||
return (ERROR);
|
||||
}
|
||||
/*
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
|
|
@ -127,10 +147,17 @@ t_error build_sym__case_item_last(\
|
|||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
*/
|
||||
|
||||
t_error build_sym_case_item(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
(void)(self);
|
||||
(void)(input);
|
||||
(void)(out);
|
||||
return (ERROR);
|
||||
}
|
||||
/*
|
||||
t_ast_node ret;
|
||||
t_ast_node tmp;
|
||||
t_usize i;
|
||||
|
|
@ -164,3 +191,4 @@ t_error build_sym_case_item(\
|
|||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue