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 --- Makefile | 4 ++-- src/lexer/utils.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0aabc5a..0e2168b 100644 --- a/Makefile +++ b/Makefile @@ -6,13 +6,13 @@ # By: cacharle +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/02/03 04:14:24 by cacharle #+# #+# # -# Updated: 2020/10/02 12:52:19 by cacharle ### ########.fr # +# Updated: 2020/10/08 13:46:23 by cacharle ### ########.fr # # # # **************************************************************************** # RM = rm -f MAKE = make --no-print-directory -JOBS = 4 +JOBS = 2 DOXYGEN = doxygen DOXYGEN_FILE = Doxyfile DOC_DIR = doc 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