/* ************************************************************************** */ /* */ /* :::::::: */ /* lexer_parse_input.c :+: :+: */ /* +:+ */ /* By: qmennen +#+ */ /* +#+ */ /* Created: 2025/02/05 19:09:20 by qmennen #+# #+# */ /* Updated: 2025/02/26 16:13:54 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ #include "minishell.h" //TODO: Check if unicode support is viable /** * @brief Parses the input from the lexer and returns a list of tokens. * * This function continuously retrieves the next token from the lexer and adds * it to a linked list until an end-of-file (EOF) or error token is encountered. * The list of tokens is then returned. * * @param lexer A pointer to the lexer structure containing * the input to be parsed. * @return A linked list of tokens parsed from the input. */ t_list *ft_parse_input(t_minishell *msh) { t_list *list; t_token *token; t_lexer *lexer; lexer = msh->lexer; list = NULL; while (TRUE) { token = ft_token_next(msh, lexer); if (token->type == T_EOF || token->type == T_ERROR) break ; ft_lstadd_back(&list, ft_lstnew_safe(msh, token)); } ft_token_free(msh, token); return (list); }