From 209c15cee6e0c3604d34a1d1d656e045e71b1c9d Mon Sep 17 00:00:00 2001 From: nass1pro Date: Mon, 15 Jun 2020 19:50:47 +0200 Subject: Update lexer stick OK --- src/lexer/trim.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/lexer') diff --git a/src/lexer/trim.c b/src/lexer/trim.c index 0f2cde1..ad696a4 100644 --- a/src/lexer/trim.c +++ b/src/lexer/trim.c @@ -1,20 +1,24 @@ #include "lexer.h" -char *del_space(char *str) +char *del_space(t_token *tk) { int i; char *s; i = 0; - while(str[++i] != '\0') + while(tk->content[++i] != '\0') { - if(str[i] == '\\' && str[i + 1] == ' ') + if(tk->content[i] == '\\' && tk->content[i + 1] == ' ') + { i += 2; - if(str[i] == ' ') + if (tk->content[i] == '\0') + tk->tag = tk->tag | TAG_STICK; + } + if(tk->content[i] == ' ') break; } - s = ft_strsubf(str, 0, i); + s = ft_strsubf(tk->content, 0, i); return(s); } @@ -49,7 +53,7 @@ t_ftlst *lexe_trim_out(t_ftlst *lst) } else { - tk->content = del_space(tk->content); + tk->content = del_space(tk); if(lst->next == NULL) if (tk->tag & TAG_STICK) tk->tag -= TAG_STICK; -- cgit