fix quote sticked to parenthesis + tokenizer upgraded from older version

This commit is contained in:
gazhonsepaskwa
2025-02-18 10:00:28 +01:00
parent 01e6313aa5
commit 84d6079a44
4 changed files with 135 additions and 80 deletions

View File

@@ -37,3 +37,39 @@ int trim_nodes(t_node *head)
}
return (1);
}
static bool is_space(char c)
{
if ((c >= 9 && c <= 13) || c == 32)
return (true);
else
return (false);
}
static int skip_quote(char *str)
{
int i;
if (!str[1])
return 0;
i = 1;
while(str[i] && str[i] != '\'' && str[i] != '"')
i++;
return (i);
}
int goto_nxt_space(char *str)
{
int i;
i = 0;
while (is_space(str[i]))
i++;
while (str[i] && !is_space(str[i]))
{
if (str[i] == '\'' || str[i] == '"')
i += skip_quote(&(str[i]));
i++;
}
return (i);
}