From df8c6fc0919dd35d80d5c72c1956cf8ed7e26b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl?= Date: Sat, 28 Sep 2024 15:27:35 +0200 Subject: [PATCH] style: normed all the stuff --- parser/src/quotes.c | 5 ++++- parser/src/token.c | 14 +++++--------- parser/src/token_lifetime.c | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/parser/src/quotes.c b/parser/src/quotes.c index cb4b9464..6f9a9353 100644 --- a/parser/src/quotes.c +++ b/parser/src/quotes.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/27 11:46:45 by rparodi #+# #+# */ -/* Updated: 2024/09/28 11:50:00 by rparodi ### ########.fr */ +/* Updated: 2024/09/28 14:49:11 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -39,10 +39,13 @@ bool is_quote(char c) */ t_error find_end_string(t_str raw, t_usize *start, t_token *output) { + char tmp; + if (!raw || !output) return (ERROR); if (is_quote(raw[(*start)])) { + tmp = raw[(*start)]; string_push_char(&output->string, raw[(*start)]); (*start)++; if (raw[(*start)] == '\0') diff --git a/parser/src/token.c b/parser/src/token.c index e71266d6..12920b74 100644 --- a/parser/src/token.c +++ b/parser/src/token.c @@ -6,28 +6,22 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/25 16:27:03 by rparodi #+# #+# */ -/* Updated: 2024/09/28 14:48:31 by maiboyer ### ########.fr */ +/* Updated: 2024/09/28 15:27:28 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "parser/token.h" #include "me/string/string.h" #include "me/types.h" +#include "me/char/char.h" #include "me/vec/vec_token.h" #include #include #include "me/mem/mem.h" - // MAIX: attention les whitespace peuvent aussi etre des tab. de memoire il y a // une fonction "me_isspace" qui check ce qu'on veut dans "me/char/char.h" -/** - * @brief boolean function that's say if it's a space or not - * - * @param c character will be checked - * @return true if it's space, if not return false - */ -bool is_space(char c) +bool me_isspace(char c) { if (c == ' ') return (true); @@ -42,6 +36,8 @@ t_error start_analyse(t_const_str raw, enum e_token list, t_vec_token *output) t_usize i; t_token token; + if (!raw || !output) + return (ERROR); i = 0; while (raw[i] != '\0') { diff --git a/parser/src/token_lifetime.c b/parser/src/token_lifetime.c index c43ccd75..226fb959 100644 --- a/parser/src/token_lifetime.c +++ b/parser/src/token_lifetime.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/28 14:37:13 by maiboyer #+# #+# */ -/* Updated: 2024/09/28 14:57:17 by maiboyer ### ########.fr */ +/* Updated: 2024/09/28 15:24:06 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -33,7 +33,7 @@ t_token token_new_meta(enum e_token type) .subtokens = vec_token_new(16, token_free)}); } -bool token_is_meta(t_token tok) +bool token_is_meta(t_token tok) { if (tok.type == WORD) return (true);