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/02 19:04:32 by maiboyer #+# #+# */
/* Updated: 2024/10/05 13:19:33 by maiboyer ### ########.fr */
/* Updated: 2024/10/06 13:43:38 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,7 +16,7 @@
#include "parser/passes.h"
#include "parser/token.h"
bool _can_be_varname(t_token *tok)
bool _can_be_varname(t_token *tok)
{
if (tok->type == TOK_DOLLAR)
return (true);
@ -35,7 +35,7 @@ bool _can_be_varname(t_token *tok)
/// thus it shouldn't be freed in case of error
/// - the output tokens may not be direct copy of the input tokens,
/// but need to be cloned (different allocations for stuff)
t_error ts_fold_expension(t_vec_token input, t_vec_token *output)
t_error ts_fold_expension(t_vec_token input, t_vec_token *output)
{
t_vec_token out;
t_usize i;
@ -49,10 +49,10 @@ t_error ts_fold_expension(t_vec_token input, t_vec_token *output)
vec_token_push(&out, token_clone(&input.buffer[i]));
else if (input.buffer[i].type == TOK_DOLLAR \
&& (input.buffer[i + 1].type == TOK_NQUOTE \
|| _can_be_varname(&input.buffer[i+1])))
|| _can_be_varname(&input.buffer[i + 1])))
{
tmp = token_clone(&input.buffer[++i]);
tmp.type= TOK_EXPENSION;
tmp.type = TOK_EXPENSION;
vec_token_push(&out, tmp);
}
else