matchers: add matcher for <blank> character class

This commit is contained in:
Khaïs COLIN 2025-02-14 15:06:01 +01:00
parent ac10c3b4de
commit aa12f7c971
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
3 changed files with 47 additions and 0 deletions

View file

@ -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 \

View file

@ -0,0 +1,26 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* blank.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/14 15:07:27 by khais #+# #+# */
/* Updated: 2025/02/14 15:26:28 by khais ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdbool.h>
#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);
}

View file

@ -0,0 +1,20 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* blank.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <stdbool.h>
bool is_blank(char c);
#endif