syntax analysis with simplified shell grammar
+ TODO : bug to fix in lexer.c
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/08 02:59:58 by lperrey #+# #+# */
|
||||
/* Updated: 2021/10/23 15:19:42 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/10/24 19:20:09 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -16,11 +16,17 @@
|
||||
// Init
|
||||
int init(t_all *c, char *envp[]);
|
||||
|
||||
// Shell loop
|
||||
void shell_loop(t_all *c);
|
||||
|
||||
// Lexer
|
||||
t_token *input_to_tokens(char *input);
|
||||
|
||||
// Shell loop
|
||||
void shell_loop(t_all *c);
|
||||
// Parser
|
||||
t_cmd **parsing(t_token *token_list);
|
||||
int valid_syntax(t_token *token_list);
|
||||
int valid_token(t_token **token_list, enum e_token_id token_id);
|
||||
int valid_command_separator(const t_token *token_list);
|
||||
|
||||
// Builtins
|
||||
int builtin_env(int argc, char *argv[], t_all *c);
|
||||
|
||||
@@ -6,14 +6,13 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/08 02:35:52 by lperrey #+# #+# */
|
||||
/* Updated: 2021/10/22 12:41:17 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/10/24 19:18:28 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MINISHELL_STRUCTS_H
|
||||
# define MINISHELL_STRUCTS_H
|
||||
|
||||
|
||||
enum e_token_id
|
||||
{
|
||||
T_TOKEN = 0,
|
||||
@@ -22,11 +21,7 @@ enum e_token_id
|
||||
T_PIPE = '|',
|
||||
T_DLESS, //'<<'
|
||||
T_DGREAT, //'>>'
|
||||
T_WORD,
|
||||
//T_NAME,
|
||||
//T_NEWLINE,
|
||||
//T_IO_NUMBER
|
||||
//T_ASSIGNMENT_WORD
|
||||
T_WORD
|
||||
};
|
||||
|
||||
typedef struct s_token
|
||||
@@ -36,8 +31,21 @@ typedef struct s_token
|
||||
enum e_token_id id;
|
||||
} t_token;
|
||||
|
||||
struct s_all;
|
||||
typedef int (*t_builtin_ptr)(int,char **,struct s_all *);
|
||||
|
||||
typedef struct s_cmd
|
||||
{
|
||||
char **argv;
|
||||
pid_t pid;
|
||||
t_builtin_ptr *builtin_command;
|
||||
int fd_in;
|
||||
int fd_out;
|
||||
} t_cmd;
|
||||
|
||||
typedef struct s_all
|
||||
{
|
||||
t_cmd **cmd_arr;
|
||||
char **envp;
|
||||
char *prompt_base;
|
||||
char *prompt;
|
||||
|
||||
Reference in New Issue
Block a user