This commit is contained in:
gazhonsepaskwa
2025-02-07 18:08:37 +01:00
parent cc57905fa9
commit d3849d196f
18 changed files with 178 additions and 186 deletions

View File

@@ -3,10 +3,10 @@
/* ::: :::::::: */
/* linked_list.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lderidde <lderidde@student.s19.be> +#+ +:+ +#+ */
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/15 13:38:49 by lderidde #+# #+# */
/* Updated: 2025/01/31 13:20:13 by lderidde ### ########.fr */
/* Updated: 2025/02/07 17:27:00 by nalebrun ### ########.fr */
/* */
/* ************************************************************************** */
@@ -30,7 +30,7 @@ t_node *create_node(char *val, t_token token)
int add_node_back(t_node **head, char *val, t_token token, t_pres pres)
{
t_node *tmp;
t_node *tmp;
tmp = *head;
if (!val)

View File

@@ -3,10 +3,10 @@
/* ::: :::::::: */
/* token_and_pres.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/21 08:54:32 by nalebrun #+# #+# */
/* Updated: 2025/01/21 08:54:32 by nalebrun ### ########.fr */
/* Updated: 2025/02/07 17:26:33 by nalebrun ### ########.fr */
/* */
/* ************************************************************************** */
@@ -39,22 +39,22 @@ t_token get_token(char *str)
{
t_token token;
if (!ft_strncmp(str, "&", 1) || !ft_strncmp(str, "|", 1)
|| !ft_strncmp(str, "(", 1) || !ft_strncmp(str, ")", 1)
|| !ft_strncmp(str, "<", 1) || !ft_strncmp(str, ">", 1))
if (!ft_strncmp(str, "&", 1) || !ft_strncmp(str, "|", 1) || !ft_strncmp(str,
"(", 1) || !ft_strncmp(str, ")", 1) || !ft_strncmp(str, "<", 1)
|| !ft_strncmp(str, ">", 1))
token = OPERATOR;
else
token = WORD;
return (token);
}
t_pres get_pressision(char *s, t_token token,
t_token last_token, t_pres last_pres)
t_pres get_pressision(char *s, t_token token, t_token last_token,
t_pres last_pres)
{
if (token == OPERATOR)
return (get_operator(s));
else if (last_token == OPERATOR && (last_pres == RED_R
|| last_pres == RED_L || last_pres == D_RED_R))
else if (last_token == OPERATOR && (last_pres == RED_R || last_pres == RED_L
|| last_pres == D_RED_R))
return (RED_FILE);
else if (last_token == OPERATOR && last_pres == HEREDOC)
return (LIM);

View File

@@ -3,10 +3,10 @@
/* ::: :::::::: */
/* tokenizer.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lderidde <lderidde@student.s19.be> +#+ +:+ +#+ */
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/15 13:27:57 by lderidde #+# #+# */
/* Updated: 2025/01/31 13:24:28 by lderidde ### ########.fr */
/* Updated: 2025/02/07 17:26:04 by nalebrun ### ########.fr */
/* */
/* ************************************************************************** */
@@ -45,7 +45,8 @@ static void set_token(t_node *head)
while (it != NULL)
{
it->token = get_token(it->val);
it->pressision = get_pressision(it->val, it->token, last_token, last_pres);
it->pressision = get_pressision(it->val, it->token, last_token,
last_pres);
last_token = it->token;
last_pres = it->pressision;
it = it->next;

View File

@@ -3,10 +3,10 @@
/* ::: :::::::: */
/* tokenizer_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/22 14:24:05 by nalebrun #+# #+# */
/* Updated: 2025/01/22 14:24:05 by nalebrun ### ########.fr */
/* Updated: 2025/02/07 18:04:31 by nalebrun ### ########.fr */
/* */
/* ************************************************************************** */
@@ -76,8 +76,6 @@ int trim_nodes(t_node *head)
if (!in_quote)
{
tmp = ft_strtrim(it->val, " \t\n");
if (!tmp)
return (0);
free(it->val);
it->val = tmp;
}