From fb4d6bd7e93328b3eb684fc390b91800da313564 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Thu, 8 Oct 2020 14:10:44 +0200 Subject: Fixing small bug in lexer/tok_assign_str --- src/lexer/utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lexer/utils.c b/src/lexer/utils.c index 67319d9..d2b35cb 100644 --- a/src/lexer/utils.c +++ b/src/lexer/utils.c @@ -6,7 +6,7 @@ /* By: nahaddac +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/07/16 08:18:15 by nahaddac #+# #+# */ -/* Updated: 2020/09/17 13:27:44 by nahaddac ### ########.fr */ +/* Updated: 2020/10/08 14:10:17 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -55,12 +55,15 @@ enum e_tok tok_assign_stick(t_tok_lst *tok) /* ** return tag si ** la chaine de character est un str où '' où '' +** \note the loop after ft_strpbrk is to search again if the quote was escaped */ enum e_tok tok_assign_str(t_tok_lst *tok) { char *found; found = ft_strpbrk(tok->content, "'\""); + while (found != NULL && found != tok->content && found[-1] == '\\') + found = ft_strpbrk(found + 1, "'\""); if (found == NULL) tok->tag = TAG_STR; else if (*found == '\'') -- cgit