update: token is now stored as value of the token instead of null

this change is made so that it is easier to print an error message when
invalid syntax
This commit is contained in:
2026-02-10 09:20:46 +01:00
parent 3d97d6506a
commit 609a644fa9

View File

@@ -6,7 +6,7 @@
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/02/09 18:56:41 by sede-san #+# #+# */
/* Updated: 2026/02/10 08:53:56 by sede-san ### ########.fr */
/* Updated: 2026/02/10 09:11:23 by sede-san ### ########.fr */
/* */
/* ************************************************************************** */
@@ -129,9 +129,15 @@ static t_token *read_token(
const char *line,
size_t *i)
{
while (ft_isspace(line[*i]) || is_meta(line[*i]))
const size_t start = *i;
size_t end;
while (is_meta(line[*i]))
(*i)++;
return (token_new(type, NULL));
end = *i;
while (ft_isspace(line[*i]))
(*i)++;
return (token_new(type, ft_substr(line, start, end - start)));
}
static t_token *read_word(