Improved arithmetic comprehension

This commit is contained in:
Raphaël 2024-07-21 17:49:03 +02:00
parent 32941a0c7e
commit 5402ec152a
5 changed files with 53 additions and 9 deletions

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/11 14:23:40 by maiboyer #+# #+# */
/* Updated: 2024/07/21 16:28:16 by maiboyer ### ########.fr */
/* Updated: 2024/07/21 17:42:37 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,7 +19,8 @@
enum e_ast_node_kind
{
AST_ARITHMETIC_BINARY,
AST_ARITHMETIC_EXPANSION,
AST_ARITHMETIC_EXPANSION, //RAPH
AST_ARITHMETIC_LITTERAL, //RAPH
AST_CASE,
AST_CASE_ITEM,
AST_COMMAND,
@ -50,7 +51,8 @@ enum e_ast_node_kind
union u_ast_node_data
{
t_ast_arithmetic_binary arithmetic_binary;
t_ast_arithmetic_expansion arithmetic_expansion;
t_ast_arithmetic_literal arithmetic_literal; //RAPH
t_ast_arithmetic_expansion arithmetic_expansion; //RAPH
t_ast_case case_;
t_ast_case_item case_item;
t_ast_command command;

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/11 14:24:24 by maiboyer #+# #+# */
/* Updated: 2024/07/21 16:26:36 by maiboyer ### ########.fr */
/* Updated: 2024/07/21 17:43:13 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -25,6 +25,7 @@ typedef union u_ast_node_data t_ast_node_data;
typedef struct s_ast_node *t_ast_node;
typedef struct s_ast_arithmetic_expansion t_ast_arithmetic_expansion;
typedef struct s_ast_arithmetic_literal t_ast_arithmetic_literal;
typedef struct s_ast_arithmetic_binary t_ast_arithmetic_binary;
typedef struct s_ast_case t_ast_case;
typedef struct s_ast_case_item t_ast_case_item;

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/14 17:46:58 by maiboyer #+# #+# */
/* Updated: 2024/07/21 16:26:17 by maiboyer ### ########.fr */
/* Updated: 2024/07/21 17:46:08 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -45,6 +45,7 @@ enum e_ast_arithmetic_operator
ARITH_MINUS,
ARITH_DIVIDE,
ARITH_MULT,
ARITH_MOD,
};
/*
@ -424,6 +425,17 @@ struct s_ast_arithmetic_binary
t_ast_node rhs;
};
/// NUMBER
/*struct s_ast_arithmetic_literal*/
/*{*/
/* t_i64 value;*/
/*};*/
// RAPH
struct s_ast_arithmetic_literal
{
t_ast_node value;
};
/// Command Substitution
/// ```shell
/// $(command)