Created file for builtins and fixed a bug about expansion not working correctly
This commit is contained in:
parent
1ecfba4340
commit
3f08544384
15 changed files with 243 additions and 429 deletions
|
|
@ -1,4 +1,6 @@
|
|||
SRC_FILES = \
|
||||
_not_done_function \
|
||||
_not_done_print \
|
||||
ast_alloc/ast_alloc \
|
||||
ast_alloc/ast_alloc_scripting \
|
||||
ast_free/ast_free \
|
||||
|
|
@ -7,14 +9,15 @@ from_node/arithmetic_node2 \
|
|||
from_node/artihmetic_node \
|
||||
from_node/boucle_node \
|
||||
from_node/condition_node \
|
||||
from_node/dev_node \
|
||||
from_node/expand_node \
|
||||
from_node/expansion_node \
|
||||
from_node/file_node \
|
||||
from_node/from_node \
|
||||
from_node/node_utils \
|
||||
from_node/node_utils2 \
|
||||
from_node/redirect_node \
|
||||
from_node/scripting_node \
|
||||
_not_done_function \
|
||||
_not_done_print \
|
||||
print_ast/ast_print_command \
|
||||
print_ast/ast_print_global \
|
||||
print_ast/ast_print_node \
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/09 16:25:02 by rparodi #+# #+# */
|
||||
/* Updated: 2024/08/09 16:26:09 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/08/10 18:26:15 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -22,42 +22,6 @@
|
|||
#include "parser/api.h"
|
||||
#include <stdio.h>
|
||||
|
||||
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_usize i;
|
||||
|
||||
(void)(out);
|
||||
(void)(input);
|
||||
(void)(self);
|
||||
if (out == NULL)
|
||||
return (ERROR);
|
||||
if (ts_node_symbol(self) != sym_file_redirect)
|
||||
return (ERROR);
|
||||
ret = ast_alloc(AST_FILE_REDIRECTION);
|
||||
i = 0;
|
||||
while (i < ts_node_child_count(self))
|
||||
{
|
||||
if (!ts_node_is_named(ts_node_child(self, i)) && (i++, true))
|
||||
continue ;
|
||||
if (ts_node_field_id_for_child(self, i) == field_op)
|
||||
{
|
||||
ret->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;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return (*out = ret, NO_ERROR);
|
||||
}
|
||||
|
||||
t_error build_sym_number(\
|
||||
t_parse_node self, t_const_str input, t_ast_node *out)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue