aboutsummaryrefslogtreecommitdiff
path: root/src/lexer/utils.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-08 14:10:44 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-08 14:10:44 +0200
commitfb4d6bd7e93328b3eb684fc390b91800da313564 (patch)
treec3d9b92dcee1b15fd71df500c53209fb25c639ef /src/lexer/utils.c
parentf863725c60e38ecb6087a2172f29c910c7e598c5 (diff)
downloadminishell-fb4d6bd7e93328b3eb684fc390b91800da313564.tar.gz
minishell-fb4d6bd7e93328b3eb684fc390b91800da313564.tar.bz2
minishell-fb4d6bd7e93328b3eb684fc390b91800da313564.zip
Fixing small bug in lexer/tok_assign_str
Diffstat (limited to 'src/lexer/utils.c')
-rw-r--r--src/lexer/utils.c5
1 files changed, 4 insertions, 1 deletions
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 <nahaddac@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 == '\'')