mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
matchers: add matcher for <blank> character class
This commit is contained in:
parent
ac10c3b4de
commit
aa12f7c971
3 changed files with 47 additions and 0 deletions
1
Makefile
1
Makefile
|
|
@ -25,6 +25,7 @@ srcs = \
|
||||||
src/env/envp.c \
|
src/env/envp.c \
|
||||||
src/ft_errno.c \
|
src/ft_errno.c \
|
||||||
src/get_command.c \
|
src/get_command.c \
|
||||||
|
src/parser/matchers/blank.c \
|
||||||
src/parser/matchers/identifier.c \
|
src/parser/matchers/identifier.c \
|
||||||
src/parser/matchers/metacharacter.c \
|
src/parser/matchers/metacharacter.c \
|
||||||
src/parser/worddesc/worddesc.c \
|
src/parser/worddesc/worddesc.c \
|
||||||
|
|
|
||||||
26
src/parser/matchers/blank.c
Normal file
26
src/parser/matchers/blank.c
Normal 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);
|
||||||
|
}
|
||||||
20
src/parser/matchers/blank.h
Normal file
20
src/parser/matchers/blank.h
Normal 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue