-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlexer.c
32 lines (29 loc) · 1.2 KB
/
lexer.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lexer.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asabani <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/25 17:04:34 by omoussao #+# #+# */
/* Updated: 2022/03/01 23:00:53 by asabani ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
t_lexer *lexer(char *cmdline)
{
t_lexer *tokens;
if (!cmdline || !*cmdline)
return (NULL);
if (!ft_isspace(*cmdline))
add_history(cmdline);
tokens = tokenizer(cmdline);
if (!validate_syntax(tokens))
{
set_status(2);
return (NULL);
}
tokens = expander(tokens);
del_front(tokens);
return (tokens);
}