update: fix word

This commit is contained in:
maix0 2024-10-06 15:30:55 +02:00
parent 0df91727b0
commit 9c2c977545
4 changed files with 13 additions and 11 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/06 15:21:47 by rparodi ### ########.fr */
/* Updated: 2024/10/06 15:30:07 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,7 +15,7 @@
#include "me/types.h"
#include "me/vec/vec_token.h"
#include "parser/token.h"
#include "stdbool.h"
#include <stdbool.h>
/// This is a sample pass
///
@ -37,7 +37,7 @@ bool _type_extansion(enum e_token type)
return (false);
}
t_error ts_fold_double_quote(t_vec_token input, t_vec_token *output)
t_error ts_fold_into_word(t_vec_token input, t_vec_token *output)
{
t_vec_token out;
t_usize i;
@ -48,14 +48,14 @@ t_error ts_fold_double_quote(t_vec_token input, t_vec_token *output)
out = vec_token_new(input.len, token_free);
while (i < input.len)
{
if (token_is_noquote(input.buffer[i].type))
if (_type_extansion(input.buffer[i].type))
{
j = 0;
tmp = token_new(TOK_WORD);
tmp = token_new_meta(TOK_WORD);
while (i + j < input.len \
&& token_is_noquote(input.buffer[i + j].type))
if (_type_extansion(input.buffer->type))
vec_token_push(&tmp.subtokens, token_clone(&input.buffer[i+j]));
&& _type_extansion(input.buffer[i + j].type))
vec_token_push(&tmp.subtokens, \
token_clone(&input.buffer[i + j++]));
vec_token_push(&out, tmp);
i += j;
}