Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
yabtaour
GitHub Repository: yabtaour/Minishell-42
Path: blob/main/lexer/lexer_utils.c
1407 views
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* lexer_utils.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: yabtaour <[email protected]> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2022/07/26 18:16:49 by yabtaour #+# #+# */
9
/* Updated: 2022/07/26 18:16:50 by yabtaour ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "../minishell.h"
14
15
int ft_is_parenth(char c)
16
{
17
if (c == '{' || c == '}'
18
|| c == '(' || c == ')')
19
return (1);
20
return (0);
21
}
22
23
int ft_is_redirection(char c)
24
{
25
if (c == '<' || c == '>')
26
return (1);
27
return (0);
28
}
29
30
int ft_is_word(char c)
31
{
32
if (c != '|' && c != '&' && !ft_is_redirection(c)
33
&& !ft_isspace(c) && c != ';' && !ft_is_parenth(c))
34
return (1);
35
return (0);
36
}
37
38