update: added extremely basic parsing, only for separated environment variables

This commit is contained in:
2025-10-23 14:10:48 +02:00
parent 92ed2bbd3e
commit b55dd50aa5
4 changed files with 149 additions and 1 deletions

20
include/chardefs.h Normal file
View File

@@ -0,0 +1,20 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* chardefs.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/23 13:23:25 by sede-san #+# #+# */
/* Updated: 2025/10/23 13:24:41 by sede-san ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef CHARDEFS_H
# define CHARDEFS_H
# define DOLLAR '$'
# define SINGLE_QUOTE '\''
# define DOUBLE_QUOTE '\"'
#endif /* CHARDEFS_H */

View File

@@ -6,7 +6,7 @@
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/20 16:35:10 by sede-san #+# #+# */
/* Updated: 2025/10/22 19:19:46 by sede-san ### ########.fr */
/* Updated: 2025/10/23 13:25:25 by sede-san ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,6 +15,8 @@
# include "libft.h"
# include "core.h"
# include "parser.h"
# include "chardefs.h"
# include <readline/readline.h> // readline(3), rl_clear_history(),
// rl_on_new_line(), rl_replace_line(),
// rl_redisplay()

38
include/parser.h Normal file
View File

@@ -0,0 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parser.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/22 19:03:51 by sede-san #+# #+# */
/* Updated: 2025/10/23 13:31:09 by sede-san ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PARSER_H
# define PARSER_H
# include "minishell.h"
/******************************************************************************/
/* Structures & Data Types */
/******************************************************************************/
typedef struct s_command t_command;
typedef struct s_command
{
int argc;
char **argv;
} t_command;
/******************************************************************************/
/* Functions */
/******************************************************************************/
// parser.c
extern char *parse(char *line, t_minishell *minishell);
#endif /* PARSER_H */