/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* cmd_parsing.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jguelen +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/03/31 10:28:28 by jguelen #+# #+# */ /* Updated: 2025/04/04 18:38:59 by jguelen ### ########.fr */ /* */ /* ************************************************************************** */ #include "cmd_parsing.h" /* ** NOTE: This file will temporarily include way more fucntions than allowed. */ void parse_error(t_minishell *app, t_worddesc *token) { ft_dprintf(STDERR_FILENO, "minishell: syntax error near unexpected " "token `%s'", token->word); app->last_return_value = 2; } t_connector which_connector_type(t_worddesc *token) { } t_cmd *minishell_simple_lst_parse(t_minishell *app, t_cmd_builder *builder) { } t_cmd *minishell_redir_parse(t_minishell *app, t_cmd_builder *builder) { } t_cmd *minishell_simple_parse(t_minishell *app, t_cmd_builder *builder) { } t_cmd *minishell_opt_pipeline_parse(t_minishell *app, t_cmd_builder *builder) { } t_cmd *minishell_group_or_smp_parse(t_minishell *app, t_cmd_builder *builder) { } t_cmd *minishell_opt_cmds_parse(t_minishell *app, t_cmd_builder *builder) { } t_cmd *minishell_pipeline_parse(t_minishell *app, t_cmd_builder *builder) { } t_cmd *minishell_cmds_parse(t_minishell *app, t_cmd_builder *builder) { } /* ** TODO Recheck error cases to see if allocation error occurred or something ** else and if this is necessary. */ t_cmd *minishell_parse(t_minishell *app, char *command_line) { t_cmd_builder builder; t_cmd *root_cmd; builder.tokens = minishell_wordsplit(command_line); if (!builder.tokens) return (NULL); root_cmd = minishell_cmds_parse(app, &builder); if (!root_cmd || builder.tokens) { parse_error(app, builder.tokens->word); return (NULL); } return (root_cmd); }