diff options
Diffstat (limited to 'src/lexer')
| -rw-r--r-- | src/lexer/lexer_utils.c | 6 | ||||
| -rw-r--r-- | src/lexer/trim.c | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/lexer/lexer_utils.c b/src/lexer/lexer_utils.c index c6bf54a..616c0d3 100644 --- a/src/lexer/lexer_utils.c +++ b/src/lexer/lexer_utils.c @@ -62,6 +62,8 @@ static int lex_verif_simple_cote(char *input, int i) while(input[i] != '\0') { ++i; + if(input[i] == '\\') + i+=1; if(input[i] == '\'') break; } @@ -77,7 +79,11 @@ int lexer_verif_entre_cote(char *input, int i) return(lex_verif_simple_cote(input, i)); i++; while(input[i] != '"' && (input[i] != '\0')) + { + if (input[i] == '\\') + i += 1; ++i; + } if (input[i + 1] == ' ') while(input[i + 1] == ' ') i++; diff --git a/src/lexer/trim.c b/src/lexer/trim.c index a0c7dec..6c435d5 100644 --- a/src/lexer/trim.c +++ b/src/lexer/trim.c @@ -27,10 +27,14 @@ char *del_quote(char *str) int i; char *s; - i = 1; - while(str[++i] != '\0') + i = 0; + while(str[i++] != '\0') + { + if(str[i] == '\\') + i+=2; if (str[i] == '\'' || str[i] == '"') break; + } s = ft_strsubf(str, 1, i - 1); return (s); } @@ -46,7 +50,6 @@ t_ftlst *lexe_trim_out(t_ftlst *lst) tk = lst->data; if (tk->tag & (TAG_STR_DOUBLE | TAG_STR_SINGLE)) { - //printf("%s\n",tk->content ); tk->content = del_quote(tk->content); if(lst->next == NULL) if (tk->tag & TAG_STICK) |
