feat: adding the whitespace treatment (fold_whitespace)

This commit is contained in:
Raphael 2024-10-04 17:43:15 +02:00
parent 912d095886
commit 762c7df1a9
2 changed files with 58 additions and 9 deletions

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/02 18:41:16 by maiboyer #+# #+# */
/* Updated: 2024/10/04 17:19:58 by rparodi ### ########.fr */
/* Updated: 2024/10/04 17:27:36 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -38,12 +38,12 @@
// bellow is some function to apply all the different passes !
static const struct s_ts_pass_def g_ts_passes[] = {
{ts_double_string_pass, "double string parser"},
static const struct s_ts_pass_def g_ts_passes[] = {\
{ts_double_string_pass, "double string parser"}, \
{ts_fold_expension, "fold expansion"},
};
t_error ts_apply_passes(t_vec_token ts, t_vec_token *out)
t_error ts_apply_passes(t_vec_token ts, t_vec_token *out)
{
t_usize i;
t_vec_token next;
@ -63,15 +63,15 @@ t_error ts_apply_passes(t_vec_token ts, t_vec_token *out)
return (*out = ts, NO_ERROR);
}
static const struct s_ts_pass_def g_ts_dq_passes[] = {
{ts_do_fuck_all, "does nothing lol"},
static const struct s_ts_pass_def g_ts_dq_passes[] = {\
{ts_do_fuck_all, "does nothing lol"}, \
{ts_fold_expension, "fold expansion"},
};
t_error ts_dq_apply_passes(t_vec_token ts, t_vec_token *out)
t_error ts_dq_apply_passes(t_vec_token ts, t_vec_token *out)
{
t_usize i;
t_vec_token next;
t_vec_token next;
i = 0;
while (i < sizeof(g_ts_dq_passes) / sizeof(g_ts_dq_passes[0]))
@ -79,7 +79,8 @@ t_error ts_dq_apply_passes(t_vec_token ts, t_vec_token *out)
if (g_ts_dq_passes[i].fn == NULL)
return (vec_token_free(ts), ERROR);
if ((g_ts_dq_passes[i].fn)(ts, &next))
return (me_eprintf("failed on '%s' dq token pass\n", g_ts_dq_passes[i].name), ERROR);
return (me_eprintf(\
"failed on '%s' dq token pass\n", g_ts_dq_passes[i].name), ERROR);
else
me_printf("Applied '%s' dq_pass\n", g_ts_dq_passes[i].name);
ts = next;