mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
parse-cmd: Slow start. Ideas starting to coalesce.
This commit is contained in:
parent
9acee63d22
commit
90d213bf98
1 changed files with 21 additions and 4 deletions
|
|
@ -13,9 +13,11 @@
|
||||||
#include "cmd_parsing.h"
|
#include "cmd_parsing.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** NOTE: This file will temporarily include way more fucntions than allowed.
|
** NOTE: This file will temporarily include way more functions than allowed.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
** Maybe include desctruction of builder contents here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void parse_error(t_minishell *app, t_worddesc *token)
|
void parse_error(t_minishell *app, t_worddesc *token)
|
||||||
{
|
{
|
||||||
ft_dprintf(STDERR_FILENO, "minishell: syntax error near unexpected "
|
ft_dprintf(STDERR_FILENO, "minishell: syntax error near unexpected "
|
||||||
|
|
@ -31,7 +33,7 @@ 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_redirect *minishell_redir_parse(t_minishell *app, t_cmd_builder *builder)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,8 +57,23 @@ t_cmd *minishell_pipeline_parse(t_minishell *app, t_cmd_builder *builder)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Parse list of commands or pipeline.
|
||||||
|
*/
|
||||||
t_cmd *minishell_cmds_parse(t_minishell *app, t_cmd_builder *builder)
|
t_cmd *minishell_cmds_parse(t_minishell *app, t_cmd_builder *builder)
|
||||||
{
|
{
|
||||||
|
t_cmd *subtree;
|
||||||
|
t_cmd *opt;
|
||||||
|
|
||||||
|
subtree = minishell_pipeline_parse(app, builder);
|
||||||
|
if (!subtree)
|
||||||
|
return (NULL); //ft_errno?
|
||||||
|
ft_errno(FT_ESUCCESS);
|
||||||
|
opt = minishell_opt_cmds_parse(app, builder);
|
||||||
|
if (!opt && ft_errno_get() != FT_ESUCCESS)
|
||||||
|
return (NULL);
|
||||||
|
if ()
|
||||||
|
return (subtree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -73,7 +90,7 @@ t_cmd *minishell_parse(t_minishell *app, char *command_line)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
root_cmd = minishell_cmds_parse(app, &builder);
|
root_cmd = minishell_cmds_parse(app, &builder);
|
||||||
if (!root_cmd || builder.tokens)
|
if (!root_cmd || builder.tokens)
|
||||||
{
|
{
|
||||||
parse_error(app, builder.tokens->word);
|
parse_error(app, builder.tokens->word);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue