update: base of tokenizer

This commit is contained in:
maix0 2024-09-30 20:25:03 +02:00
parent 24d8bf5fc9
commit b5556b9063
10 changed files with 215 additions and 219 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/06 16:31:41 by rparodi #+# #+# */
/* Updated: 2024/09/26 18:14:19 by maiboyer ### ########.fr */
/* Updated: 2024/09/30 20:06:27 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -47,6 +47,7 @@ t_error get_user_input(t_state *state)
}
}
line_edit_stop(&lstate);
printf("state->str_input = %s\n", state->str_input);
return (NO_ERROR);
}

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */
/* Updated: 2024/09/26 18:14:59 by maiboyer ### ########.fr */
/* Updated: 2024/09/30 20:11:12 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -22,6 +22,8 @@
#include "me/str/str.h"
#include "me/string/string.h"
#include "me/types.h"
#include "me/vec/vec_str.h"
#include "me/vec/vec_token.h"
#include <errno.h>
#include <sys/types.h>
@ -97,9 +99,21 @@ void print_node_data(t_node *t, t_usize depth)
}
*/
void parse_str(t_state *state)
t_str token_name(t_token *out);
void func(t_usize i, t_token *token, void *state)
{
(void)(state);
(void)(i);
printf("%s => %s\n", token_name(token), token->string.buf);
}
t_error tokenize(t_const_str s, t_vec_token *out);
void parse_str(t_state *state)
{
t_vec_token tokens;
if (tokenize(state->str_input, &tokens))
return ;
vec_token_iter(&tokens, func, NULL);
}
t_i32 main(t_i32 argc, t_str argv[], t_str envp[])