feat: adding all double for the fucking tokeinisation (coucou froz mais retourne en vacances the order first + correction bocal for maiboyer)

This commit is contained in:
Raphael 2024-10-04 19:11:06 +02:00
parent 8c18d18512
commit 17b5d3038b
6 changed files with 32 additions and 9 deletions

View file

@ -1,12 +1,15 @@
SRC_FILES = \ SRC_FILES = \
passes \ passes \
passes/double_quote_parsing \ passes/double_quote_parsing \
passes/fold_double_amp \
passes/fold_double_carret \
passes/fold_double_pipe \
passes/fold_expansion \ passes/fold_expansion \
passes/fold_whitespace \ passes/fold_whitespace \
passes/template_file \ passes/template_file \
token_lifetime \
tokenizer \ tokenizer \
tokenizer_utils \ tokenizer_utils \
token_lifetime \
GEN_FILES = \ GEN_FILES = \
\ \

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */ /* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/02 18:43:41 by maiboyer #+# #+# */ /* Created: 2024/10/02 18:43:41 by maiboyer #+# #+# */
/* Updated: 2024/10/04 18:30:05 by maiboyer ### ########.fr */ /* Updated: 2024/10/04 19:01:40 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -35,9 +35,13 @@ t_error ts_dq_apply_passes(t_vec_token ts, t_vec_token *out);
// list passes function here // list passes function here
// this is a example one, does absolutly nothing lol // this is a example one, does absolutly nothing lol
t_error ts_do_fuck_all(t_vec_token input, t_vec_token *output); t_error ts_double_amp(t_vec_token input, t_vec_token *output);
t_error ts_fold_expension(t_vec_token input, t_vec_token *output); t_error ts_double_lcarret(t_vec_token input, t_vec_token *output);
t_error ts_double_pipe(t_vec_token input, t_vec_token *output);
t_error ts_double_rcarret(t_vec_token input, t_vec_token *output);
t_error ts_double_string_pass(t_vec_token input, t_vec_token *output); t_error ts_double_string_pass(t_vec_token input, t_vec_token *output);
t_error ts_fold_whitespace(t_vec_token input, t_vec_token *output); t_error ts_fold_whitespace(t_vec_token input, t_vec_token *output);
t_error ts_do_fuck_all(t_vec_token input, t_vec_token *output);
t_error ts_fold_expension(t_vec_token input, t_vec_token *output);
#endif /* PASSES_H */ #endif /* PASSES_H */

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */ /* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/02 18:41:16 by maiboyer #+# #+# */ /* Created: 2024/10/02 18:41:16 by maiboyer #+# #+# */
/* Updated: 2024/10/04 18:32:18 by maiboyer ### ########.fr */ /* Updated: 2024/10/04 19:06:20 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -40,6 +40,10 @@ static const struct s_ts_pass_def g_ts_passes[] = {\
{ts_double_string_pass, "double string parser"}, \ {ts_double_string_pass, "double string parser"}, \
{ts_fold_expension, "fold expansion"}, {ts_fold_expension, "fold expansion"},
{ts_fold_whitespace, "fold whitespace"}, {ts_fold_whitespace, "fold whitespace"},
{ts_double_amp, "double amp => and"},
{ts_double_pipe, "double pipe => or"},
{ts_double_lcarret, "double lcarret => dlcarret"},
{ts_double_rcarret, "double rcarrer => drcarret"},
}; };
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)

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */ /* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/02 19:04:32 by maiboyer #+# #+# */ /* Created: 2024/10/02 19:04:32 by maiboyer #+# #+# */
/* Updated: 2024/10/04 18:55:34 by rparodi ### ########.fr */ /* Updated: 2024/10/04 19:09:45 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -39,7 +39,10 @@ t_error ts_double_amp(t_vec_token input, t_vec_token *output)
vec_token_push(&out, token_clone(&input.buffer[i])); vec_token_push(&out, token_clone(&input.buffer[i]));
else if (input.buffer[i].type == TOK_AMP else if (input.buffer[i].type == TOK_AMP
&& input.buffer[i + 1].type == TOK_AMP) && input.buffer[i + 1].type == TOK_AMP)
{
vec_token_push(&out, token_new(TOK_AND)); vec_token_push(&out, token_new(TOK_AND));
i++;
}
else else
vec_token_push(&out, token_clone(&input.buffer[i])); vec_token_push(&out, token_clone(&input.buffer[i]));
i++; i++;

View file

@ -1,12 +1,12 @@
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* ::: :::::::: */ /* ::: :::::::: */
/* fold_double_lcarret.c :+: :+: :+: */ /* fold_double_carret.c :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */ /* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/02 19:04:32 by maiboyer #+# #+# */ /* Created: 2024/10/02 19:04:32 by maiboyer #+# #+# */
/* Updated: 2024/10/04 18:58:16 by rparodi ### ########.fr */ /* Updated: 2024/10/04 19:09:30 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -39,7 +39,10 @@ t_error ts_double_lcarret(t_vec_token input, t_vec_token *output)
vec_token_push(&out, token_clone(&input.buffer[i])); vec_token_push(&out, token_clone(&input.buffer[i]));
else if (input.buffer[i].type == TOK_LCARRET else if (input.buffer[i].type == TOK_LCARRET
&& input.buffer[i + 1].type == TOK_LCARRET) && input.buffer[i + 1].type == TOK_LCARRET)
{
vec_token_push(&out, token_new(TOK_DLCARRET)); vec_token_push(&out, token_new(TOK_DLCARRET));
i++;
}
else else
vec_token_push(&out, token_clone(&input.buffer[i])); vec_token_push(&out, token_clone(&input.buffer[i]));
i++; i++;
@ -61,7 +64,10 @@ t_error ts_double_rcarret(t_vec_token input, t_vec_token *output)
vec_token_push(&out, token_clone(&input.buffer[i])); vec_token_push(&out, token_clone(&input.buffer[i]));
else if (input.buffer[i].type == TOK_RCARRET else if (input.buffer[i].type == TOK_RCARRET
&& input.buffer[i + 1].type == TOK_RCARRET) && input.buffer[i + 1].type == TOK_RCARRET)
{
vec_token_push(&out, token_new(TOK_DRCARRET)); vec_token_push(&out, token_new(TOK_DRCARRET));
i++;
}
else else
vec_token_push(&out, token_clone(&input.buffer[i])); vec_token_push(&out, token_clone(&input.buffer[i]));
i++; i++;

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */ /* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/02 19:04:32 by maiboyer #+# #+# */ /* Created: 2024/10/02 19:04:32 by maiboyer #+# #+# */
/* Updated: 2024/10/04 18:47:39 by rparodi ### ########.fr */ /* Updated: 2024/10/04 19:08:48 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -39,7 +39,10 @@ t_error ts_double_pipe(t_vec_token input, t_vec_token *output)
vec_token_push(&out, token_clone(&input.buffer[i])); vec_token_push(&out, token_clone(&input.buffer[i]));
else if (input.buffer[i].type == TOK_PIPE else if (input.buffer[i].type == TOK_PIPE
&& input.buffer[i + 1].type == TOK_PIPE) && input.buffer[i + 1].type == TOK_PIPE)
{
vec_token_push(&out, token_new(TOK_OR)); vec_token_push(&out, token_new(TOK_OR));
i++;
}
else else
vec_token_push(&out, token_clone(&input.buffer[i])); vec_token_push(&out, token_clone(&input.buffer[i]));
i++; i++;