minishell/src/parser/cmd_parsing.h
2025-04-08 16:29:57 +02:00

49 lines
2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cmd_parsing.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jguelen <jguelen@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/28 17:49:55 by jguelen #+# #+# */
/* Updated: 2025/04/08 13:55:42 by jguelen ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef CMD_PARSING_H
# define CMD_PARSING_H
# include "../minishell.h"
# include "../ft_errno.h"
typedef struct s_cmd_builder
{
t_wordlist *tokens;
t_wordlist *current_wordlist;
t_redirect *current_redirection_list;
t_worddesc *current_word;
/*
** last_here_doc is meant to store only one entry.
*/
t_redirectee *last_here_doc;
} t_cmd_builder;
void parse_error(t_minishell *app, t_worddesc *token);
t_cmd *minishell_parse(t_minishell *app, char *command_line);
t_cmd *minishell_cmds_parse(t_minishell *app, t_cmd_builder *builder);
t_cmd *minishell_pipeline_parse(t_minishell *app, t_cmd_builder *builder);
t_cmd *minishell_opt_cmds_parse(t_minishell *app, t_cmd_builder *builder,
t_connector *connec);
t_cmd *minishell_group_or_smp_parse(t_minishell *app,
t_cmd_builder *builder);
t_cmd *minishell_opt_pipeline_parse(t_minishell *app,
t_cmd_builder *builder);
t_cmd *minishell_simple_parse(t_minishell *app, t_cmd_builder *builder);
t_redirect *minishell_redir_parse(t_minishell *app, t_cmd_builder *builder);
t_cmd *minishell_simple_lst_parse(t_minishell *app,
t_cmd_builder *builder);
t_connector which_connector_type(t_worddesc *token);
#endif