unexpected token
This commit is contained in:
@@ -25,17 +25,31 @@ int syntax_err_mess(char *token)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int unexpected_token(t_node *node)
|
||||||
|
{
|
||||||
|
if (!ft_strncmp(node->val, "%", 1)
|
||||||
|
|| (!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 syntax_error(t_node *head)
|
int syntax_error(t_node *head)
|
||||||
{
|
{
|
||||||
// t_node *cpy;
|
t_node *cpy;
|
||||||
|
|
||||||
if (only_operator(head))
|
if (only_operator(head))
|
||||||
return(syntax_err_mess(head->val));
|
return(syntax_err_mess(head->val));
|
||||||
// cpy = node;
|
cpy = head;
|
||||||
// while (cpy)
|
while (cpy)
|
||||||
// {
|
{
|
||||||
// cpy = cpy->next;
|
if (unexpected_token(cpy))
|
||||||
// }
|
return (syntax_err_mess(cpy->val));
|
||||||
|
cpy = cpy->next;
|
||||||
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user