diff --git a/Makefile b/Makefile index 46d4a72..9e47358 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ srcs = \ src/env/envp.c \ src/ft_errno.c \ src/get_command.c \ + src/parser/matchers/blank.c \ src/parser/matchers/identifier.c \ src/parser/matchers/metacharacter.c \ src/parser/worddesc/worddesc.c \ diff --git a/src/parser/matchers/blank.c b/src/parser/matchers/blank.c new file mode 100644 index 0000000..8135a36 --- /dev/null +++ b/src/parser/matchers/blank.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* blank.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: khais +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/02/14 15:07:27 by khais #+# #+# */ +/* Updated: 2025/02/14 15:26:28 by khais ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "libft.h" + +/* +** https://pubs.opengroup.org/onlinepubs/9699919799/ +** section 7.3.1 LC_CTYPE, blank character class +*/ +bool is_blank(char c) +{ + if (ft_strchr(" \t", c) != NULL) + return (true); + else + return (false); +} diff --git a/src/parser/matchers/blank.h b/src/parser/matchers/blank.h new file mode 100644 index 0000000..f779c48 --- /dev/null +++ b/src/parser/matchers/blank.h @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* blank.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: khais +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/02/14 15:08:36 by khais #+# #+# */ +/* Updated: 2025/02/14 15:09:02 by khais ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef BLANK_H +# define BLANK_H + +# include + +bool is_blank(char c); + +#endif