fixes + norm
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/07 12:08:53 by nalebrun #+# #+# */
|
||||
/* Updated: 2025/02/07 17:58:30 by nalebrun ### ########.fr */
|
||||
/* Updated: 2025/02/11 16:31:12 by nalebrun ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
int syntax_err_mess(char *token_base, int selected)
|
||||
{
|
||||
char *token;
|
||||
char *token;
|
||||
|
||||
token = ft_strdup(token_base);
|
||||
if (selected == 0)
|
||||
@@ -33,19 +33,9 @@ int syntax_err_mess(char *token_base, int selected)
|
||||
return (1);
|
||||
}
|
||||
|
||||
int unexpected_token(t_node *node)
|
||||
static int check_unclosed(char *c, t_node *node)
|
||||
{
|
||||
if ((!ft_strncmp(node->val, "&", 1) && ft_strncmp(node->val, "&&", 2))
|
||||
|| !ft_strncmp(node->val, ";", 1) || !ft_strncmp(node->val, "[", 1)
|
||||
|| !ft_strncmp(node->val, "]", 1) || !ft_strncmp(node->val, "{", 1)
|
||||
|| !ft_strncmp(node->val, "}", 1))
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int check_unclosed(char *c, t_node *node)
|
||||
{
|
||||
t_node *cpy;
|
||||
t_node *cpy;
|
||||
int count;
|
||||
|
||||
cpy = node;
|
||||
@@ -65,28 +55,28 @@ int check_unclosed(char *c, t_node *node)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int check_unclosed_quote(char *c, t_node *node)
|
||||
static int check_unclosed_quote(char *c, t_node *node)
|
||||
{
|
||||
t_node *cpy;
|
||||
int count;
|
||||
int len;
|
||||
t_node *cpy;
|
||||
int count;
|
||||
int len;
|
||||
|
||||
cpy = node;
|
||||
count = 0;
|
||||
while (cpy)
|
||||
{
|
||||
len = ft_strlen(cpy->val);
|
||||
if (len > 0 && cpy->val[0] == c[0])
|
||||
{
|
||||
if (len == 1 || cpy->val[len - 1] != c[0])
|
||||
count++;
|
||||
}
|
||||
cpy = cpy->next;
|
||||
}
|
||||
return (count % 2);
|
||||
cpy = node;
|
||||
count = 0;
|
||||
while (cpy)
|
||||
{
|
||||
len = ft_strlen(cpy->val);
|
||||
if (len > 0 && cpy->val[0] == c[0])
|
||||
{
|
||||
if (len == 1 || cpy->val[len - 1] != c[0])
|
||||
count++;
|
||||
}
|
||||
cpy = cpy->next;
|
||||
}
|
||||
return (count % 2);
|
||||
}
|
||||
|
||||
int unclosed(t_node *head)
|
||||
int unclosed(t_node *head)
|
||||
{
|
||||
if (check_unclosed("()", head) != 0)
|
||||
return (syntax_err_mess("()", check_unclosed("()", head)));
|
||||
@@ -97,17 +87,6 @@ int unclosed(t_node *head)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int is_aop_operator(t_node *node)
|
||||
{
|
||||
if (!node || node->token != OPERATOR)
|
||||
return (0);
|
||||
if (node->pressision == AND
|
||||
|| node->pressision == OR
|
||||
|| node->pressision == PIPE)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int syntax_error(t_node *head)
|
||||
{
|
||||
t_node *cpy;
|
||||
|
||||
Reference in New Issue
Block a user