aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChristopher Uhlig2024-10-17 14:22:47 +0200
committerChristopher Uhlig2024-10-17 14:22:47 +0200
commit981d02c8544388e81abf1423c31578c50d019d28 (patch)
tree195ea0964faa8abcf23712715111b2f21837e9d1 /include
parent9b1ddf7b3491f26d8b3ba9daeca7174aede9c781 (diff)
parent85d82207526e7220bd14bc96e5f8079ec781fc75 (diff)
downloadminishell-981d02c8544388e81abf1423c31578c50d019d28.tar.gz
minishell-981d02c8544388e81abf1423c31578c50d019d28.zip
removed merch conflict
Diffstat (limited to 'include')
-rw-r--r--include/ast.h28
-rw-r--r--include/env.h23
-rw-r--r--include/minishell.h13
-rw-r--r--include/token.h17
4 files changed, 39 insertions, 42 deletions
diff --git a/include/ast.h b/include/ast.h
index e6ad25d..cd2f9c9 100644
--- a/include/ast.h
+++ b/include/ast.h
@@ -6,32 +6,20 @@
/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/27 11:48:27 by dkaiser #+# #+# */
-/* Updated: 2024/06/28 14:56:55 by dkaiser ### ########.fr */
+/* Updated: 2024/08/11 12:20:56 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
-#include "stdlib.h"
#include "debug_tools.h"
-
-typedef struct s_sequence
-{
- struct s_node **nodes;
-} t_sequence;
+#include "stdlib.h"
enum e_node_type
{
- ASSIGN_NODE,
PIPE_NODE,
CMD_NODE,
STRING_NODE
};
-typedef struct s_assign
-{
- char *var;
- char *value;
-} t_assign;
-
typedef struct s_pipe
{
struct s_node *left;
@@ -40,10 +28,10 @@ typedef struct s_pipe
enum e_redirection_type
{
- INPUT_FILE,
- INPUT_LIMITER,
- OUTPUT_OVERRIDE,
- OUTPUT_APPEND
+ INPUT_FILE = 1,
+ INPUT_LIMITER = 2,
+ OUTPUT_OVERRIDE = 4,
+ OUTPUT_APPEND = 8
};
typedef struct s_redirection
@@ -60,7 +48,6 @@ typedef struct s_cmd
union u_node_content
{
- struct s_assign assign;
struct s_pipe pipe;
struct s_cmd cmd;
char *string;
@@ -73,7 +60,8 @@ typedef struct s_node
} t_node;
t_node *new_node(int type);
-t_node *new_assign_node(char *var, char *value);
t_node *new_pipe_node(t_node *left, t_node *right);
t_node *new_cmd_node(char **args, t_redirection redirs[2]);
t_node *new_string_node(char *string);
+
+void free_node(t_node *node);
diff --git a/include/env.h b/include/env.h
index 1ea6f2e..f3d3c75 100644
--- a/include/env.h
+++ b/include/env.h
@@ -6,18 +6,19 @@
/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/08 16:53:39 by dkaiser #+# #+# */
-/* Updated: 2024/08/08 17:05:11 by dkaiser ### ########.fr */
+/* Updated: 2024/09/13 16:26:16 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
-typedef struct s_env {
- char *name;
- char *value;
- struct s_env *next;
-} t_env;
+typedef struct s_env
+{
+ char *name;
+ char *value;
+ struct s_env *next;
+} t_env;
-char *env_get(t_env *env, char *name);
-void env_export(t_env *env, char *name, char *value);
-void env_unset(t_env *env, char *name);
-char **env_to_strlst(t_env *env);
-t_env **env_from_strlst(char **lst);
+char *env_get(t_env *env, char *name);
+void env_export(t_env *env, char *name, char *value);
+void env_unset(t_env *env, char *name);
+char **env_to_strlst(t_env *env);
+t_env **env_from_strlst(char **lst);
diff --git a/include/minishell.h b/include/minishell.h
index c108d93..6997b15 100644
--- a/include/minishell.h
+++ b/include/minishell.h
@@ -6,7 +6,7 @@
/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/22 17:14:49 by dkaiser #+# #+# */
-/* Updated: 2024/08/08 17:10:12 by dkaiser ### ########.fr */
+/* Updated: 2024/08/11 12:22:07 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
@@ -26,9 +26,14 @@
# include <termios.h>
# include <unistd.h>
-int init(void);
-int init_signal_handling(void);
+int init(void);
+int init_signal_handling(void);
-void repl(const char *prompt);
+void repl(const char *prompt);
+t_list *parse(t_token *tokens);
+t_node *parse_cmd(t_token *tokens);
+t_redirection *collect_redirs(t_token **tokens);
+
+void print_ast(t_node *ast);
#endif
diff --git a/include/token.h b/include/token.h
index d7ff9f9..54a65f2 100644
--- a/include/token.h
+++ b/include/token.h
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/27 13:27:18 by dkaiser #+# #+# */
-/* Updated: 2024/08/05 13:23:27 by chuhlig ### ########.fr */
+/* Updated: 2024/08/29 15:26:23 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,10 +17,10 @@
enum e_token_type
{
- STRING_TOKEN,
- PIPE_TOKEN,
- REDIR_TOKEN,
- NEWLINE_TOKEN
+ STRING_TOKEN = 1,
+ PIPE_TOKEN = 2,
+ REDIR_TOKEN = 4,
+ NEWLINE_TOKEN = 8
};
union u_token_content
@@ -45,6 +45,9 @@ t_token *new_redir_token(int type, t_token *previous,
t_token *next);
void free_token(t_token *token);
-void tokenizer(char *s, t_token **token_list);
+void free_token_and_connect(t_token *token);
+void free_tokens(t_token *tokens);
+void tokenizer(char *s, t_token **token_list,
+ char quote_check);
-#endif \ No newline at end of file
+#endif