Adding the start

This commit is contained in:
Raphael 2024-07-21 15:29:40 +02:00
parent 6c4973a87f
commit 078055d0aa
2 changed files with 35 additions and 7 deletions

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/14 17:46:58 by maiboyer #+# #+# */
/* Updated: 2024/07/20 16:28:03 by maiboyer ### ########.fr */
/* Updated: 2024/07/21 15:29:33 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -409,6 +409,14 @@ struct s_ast_arithmetic_expansion
t_ast_node expr;
};
struct s_ast_binary_op
{
t_ast_node operator;
};
{
t_ast_node expr;
};
/// Command Substitution
/// ```shell
/// $(command)

View file

@ -1,8 +1,3 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* from_node.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/17 12:41:56 by maiboyer #+# #+# */
@ -72,6 +67,8 @@ sym_while_statement
sym_word
*/
#include <ctype.h>
#include <inttypes.h>
#include <stdio.h>
#undef ERROR
@ -618,6 +615,29 @@ t_error build_sym_heredoc_start(t_parse_node self, t_const_str input, t_ast_node
#include <stdio.h>
t_error build_sym_arithmetic_binary_expression(t_parse_node self, t_const_str input, t_ast_node *out);
{
t_usize i;
t_ast_node *ret;
i = 0;
ret = ast_alloc(AST_ARITHMETIC_EXPANSION);
while (str[i] == '\0')
{
if (str[i] == '+')
ret->operator = '+';
if (str[i] == '-')
ret->operator = '-';
if (str[i] == '/')
ret->operator = '/';
if (str[i] == '%')
ret->operator = '%';
if (str[i] == '*')
ret->operator = '*';
}
}
t_error build_sym_command_substitution(t_parse_node self, t_const_str input, t_ast_node *out)
{
t_ast_node ret;