lexer (need refactoring)

+ littles miscs
This commit is contained in:
LuckyLaszlo
2021-10-19 20:25:41 +02:00
parent e451a1f050
commit 1054f3d6ff
8 changed files with 244 additions and 12 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:59:58 by lperrey #+# #+# */
/* Updated: 2021/10/10 23:55:14 by lperrey ### ########.fr */
/* Updated: 2021/10/19 19:55:08 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -16,6 +16,9 @@
// Init
int init(t_all *c, char *envp[]);
// Lexer
t_token *input_to_tokens(char *input);
// Builtins
int builtin_env(int argc, char *argv[], t_all *c);
int builtin_exit(int argc, char *argv[], t_all *c);
@@ -27,5 +30,6 @@ int free_exit(t_all *c, int exit_status);
char *ft_strjoinfree(char *s1, char *s2);
char *ft_strjoinfree_s1(char *s1, const char *s2);
char *ft_strjoinfree_s2(const char *s1, char *s2);
void ft_lstprint(t_list *lst, int fd);
#endif

View File

@@ -6,18 +6,42 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:35:52 by lperrey #+# #+# */
/* Updated: 2021/10/10 05:39:09 by lperrey ### ########.fr */
/* Updated: 2021/10/19 20:20:35 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef MINISHELL_STRUCTS_H
# define MINISHELL_STRUCTS_H
enum e_token_id
{
T_TOKEN = 0,
T_LESS = '<',
T_GREAT = '>',
T_PIPE = '|',
T_DLESS, //'<<'
T_DGREAT, //'>>'
T_WORD,
//T_NAME,
//T_NEWLINE,
//T_IO_NUMBER
//T_ASSIGNMENT_WORD
};
typedef struct s_token
{
char *content;
struct s_token *next;
enum e_token_id id;
} t_token;
typedef struct s_all
{
char **envp;
char *prompt_base;
char *prompt;
t_token *token_list;
} t_all;
#endif