aboutsummaryrefslogtreecommitdiff
path: root/src/lexer
diff options
context:
space:
mode:
Diffstat (limited to 'src/lexer')
-rw-r--r--src/lexer/lexer.c6
-rw-r--r--src/lexer/tok_lst.c15
2 files changed, 19 insertions, 2 deletions
diff --git a/src/lexer/lexer.c b/src/lexer/lexer.c
index e6aeb80..7f49431 100644
--- a/src/lexer/lexer.c
+++ b/src/lexer/lexer.c
@@ -6,7 +6,7 @@
/* By: nahaddac <nahaddac@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/16 08:18:25 by nahaddac #+# #+# */
-/* Updated: 2020/08/27 17:34:53 by charles ### ########.fr */
+/* Updated: 2020/08/27 20:45:59 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -58,6 +58,10 @@ int check_input(char *input)
}
if (lexer_sep(input[i]))
{
+ /* src/lexer/lexer.c:62:12: warning: Although the value stored to 'i' is used in the enclosing expression, the value is never actually read from 'i' */
+ /* return (i += lexer_space(&input[i + 1]) + 1); */
+ /* ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
if (input[i] == ';')
return (i += lexer_space(&input[i + 1]) + 1);
while(input[i] == input[i + 1] && op < 2)
diff --git a/src/lexer/tok_lst.c b/src/lexer/tok_lst.c
index 8d29bb5..a620aa5 100644
--- a/src/lexer/tok_lst.c
+++ b/src/lexer/tok_lst.c
@@ -6,7 +6,7 @@
/* By: charles <me@cacharle.xyz> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/08/27 09:32:58 by charles #+# #+# */
-/* Updated: 2020/08/27 18:40:05 by charles ### ########.fr */
+/* Updated: 2020/08/27 20:54:35 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -31,6 +31,7 @@ t_tok_lst *tok_lst_new_until(enum e_tok tag, char *content, size_t n)
return (NULL);
}
ret->tag = tag;
+ ret->next = NULL;
return (ret);
}
@@ -57,3 +58,15 @@ t_tok_lst *tok_lst_last(t_tok_lst *tokens)
{
return ((t_tok_lst*)ft_lstlast((t_ftlst*)tokens));
}
+
+t_tok_lst *tok_lst_pop_front(t_tok_lst **tokens)
+{
+ t_tok_lst *poped;
+
+ if (tokens == NULL || *tokens == NULL)
+ return (NULL);
+ poped = *tokens;
+ *tokens = poped->next;
+ poped->next = NULL;
+ return (poped);
+}