update: normed stuff

This commit is contained in:
maix0 2024-10-06 13:53:30 +02:00
parent 71d9a201b5
commit b058348d35
20 changed files with 388 additions and 193 deletions

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/05 18:51:50 by maiboyer #+# #+# */
/* Updated: 2024/10/05 18:53:18 by maiboyer ### ########.fr */
/* Updated: 2024/10/06 13:31:38 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,7 +16,8 @@
#include <stdio.h>
#include "app/colors.h"
t_str token_name(t_token *out);
t_str token_name(t_token *out);
static void _print_ts_inner(t_usize i, t_token *token, void *vdepth)
{
t_usize depth;
@ -29,20 +30,20 @@ static void _print_ts_inner(t_usize i, t_token *token, void *vdepth)
i = 0;
while (i++ < depth)
string_push_char(&sdepth, '\t');
if (token->subtokens.buffer != NULL)
{
depth++;
printf("%s[" COL_GREEN "%10s"RESET"]\n", sdepth.buf ,token_name(token));
printf("%s[" COL_GREEN "%10s" RESET "]\n", \
sdepth.buf, token_name(token));
vec_token_iter(&token->subtokens, _print_ts_inner, &depth);
}
else
printf("%s[" COL_GREEN "%10s"RESET"] '"COL_YELLOW"%s"RESET"'\n",\
sdepth.buf ,token_name(token), token->string.buf);
printf("%s[" COL_GREEN "%10s" RESET "] '" COL_YELLOW "%s" RESET "'\n", \
sdepth.buf, token_name(token), token->string.buf);
string_free(sdepth);
}
void ts_print(t_vec_token *ts)
void ts_print(t_vec_token *ts)
{
vec_token_iter(ts, _print_ts_inner, NULL);
}