Files
minishell/include/parser.h
2026-02-09 20:47:43 +01:00

67 lines
1.9 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parser.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/22 19:03:51 by sede-san #+# #+# */
/* Updated: 2026/02/09 20:36:19 by sede-san ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PARSER_H
# define PARSER_H
# include "minishell.h"
# include "core.h"
# include "builtins.h"
# define PIPE_STR "|"
# define REDIRECT_IN_STR "<"
# define REDIRECT_OUT_STR ">"
# define APPEND_STR ">>"
# define HEREDOC_STR "<<"
# define TOKENS_COUNT 5
typedef enum e_token_type
{
TOKEN_WORD,
TOKEN_PIPE,
TOKEN_REDIRECT_IN,
TOKEN_REDIRECT_OUT,
TOKEN_APPEND,
TOKEN_HEREDOC
} t_token_type;
typedef struct s_token
{
t_token_type type;
char *value;
} t_token;
typedef enum e_redirection_type
{
REDIRECT_IN,
REDIRECT_OUT,
APPEND,
HEREDOC
} t_redirection_type;
typedef struct s_redirection
{
t_redirection_type type;
char *target;
} t_redirection;
/******************************************************************************/
/* Functions */
/******************************************************************************/
// parser.c
extern t_list *parse(char *line, t_minishell *minishell);
#endif /* PARSER_H */