diff --git a/parser/include/parser/token.h b/parser/include/parser/token.h index 6267bba8..ef0809c9 100644 --- a/parser/include/parser/token.h +++ b/parser/include/parser/token.h @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/26 17:59:23 by maiboyer #+# #+# */ -/* Updated: 2024/09/26 18:29:25 by maiboyer ### ########.fr */ +/* Updated: 2024/09/27 11:38:18 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -40,6 +40,4 @@ struct s_token enum e_token type; }; - - #endif /* TOKEN_H */ diff --git a/parser/src/token.c b/parser/src/token.c index 1601be34..514b143a 100644 --- a/parser/src/token.c +++ b/parser/src/token.c @@ -6,39 +6,28 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/25 16:27:03 by rparodi #+# #+# */ -/* Updated: 2024/09/26 17:56:08 by maiboyer ### ########.fr */ +/* Updated: 2024/09/27 13:14:23 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "parser/token.h" #include "me/string/string.h" #include "me/types.h" +#include "me/vec/vec_token.h" #include -t_error handle_quote(t_string raw, enum e_token actual, int *output) +t_error start_analyse(t_const_str raw, enum e_token list, t_vec_token *output) { - (void)raw; - (void)actual; - (void)output; - dprintf(2, "\tNOT DONE\n"); - return (ERROR); + } -t_error handle_arithmetic(t_string raw, enum e_token actual, int *output) -{ - (void)raw; - (void)actual; - (void)output; - dprintf(2, "\tNOT DONE\n"); - return (ERROR); -} -t_error tokeniser(t_string raw, enum e_token actual, int *output) +t_error tokeniser(t_const_str raw, enum e_token list) { + t_vec_token output; + if (!raw.buf || raw.len == 0 || raw.capacity == 0) return (ERROR); - if (handle_quote(raw, actual, output)) - return (ERROR); - else if (handle_arithmetic(raw, actual, output)) - return (ERROR); + output = vec_token_new(16, NULL); + start_analyse(raw, list, &output); return (NO_ERROR); } diff --git a/parser/src/what_is_it.c b/parser/src/what_is_it.c new file mode 100644 index 00000000..270458cd --- /dev/null +++ b/parser/src/what_is_it.c @@ -0,0 +1,24 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* what_is_it.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/09/27 11:46:45 by rparodi #+# #+# */ +/* Updated: 2024/09/27 12:48:18 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "me/vec/vec_token.h" +#include "parser/token.h" +#include "me/string/string.h" +#include "me/types.h" +#include + +bool is_quote(char c) +{ + if (c == '"' || c == '\'') + return (true); + return (false); +}