aboutsummaryrefslogtreecommitdiff
path: root/src/lexer/tok_lst.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-09 16:13:50 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-09 16:13:50 +0200
commit00bce5ad1d5ac92d20617a9eb2647365bf87cab2 (patch)
treeaaad5cbb6cdb6372f5809d50cdc65b912695956f /src/lexer/tok_lst.c
parente8075fcf93873149593ccd141f99d65a4db40f4f (diff)
downloadminishell-00bce5ad1d5ac92d20617a9eb2647365bf87cab2.tar.gz
minishell-00bce5ad1d5ac92d20617a9eb2647365bf87cab2.tar.bz2
minishell-00bce5ad1d5ac92d20617a9eb2647365bf87cab2.zip
Splitting preprocessing, Added parsed error helper
Diffstat (limited to 'src/lexer/tok_lst.c')
-rw-r--r--src/lexer/tok_lst.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/lexer/tok_lst.c b/src/lexer/tok_lst.c
index 9ae0ce1..89ab120 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/10/08 17:38:59 by cacharle ### ########.fr */
+/* Updated: 2020/10/09 15:14:38 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,7 +14,8 @@
t_tok_lst *tok_lst_new(enum e_tok tag, char *content)
{
- return (tok_lst_new_until(tag, content, content == NULL ? 0 : ft_strlen(content)));
+ return (tok_lst_new_until(
+ tag, content, content == NULL ? 0 : ft_strlen(content)));
}
/*
@@ -25,14 +26,15 @@ t_tok_lst *tok_lst_new(enum e_tok tag, char *content)
** \return An allocated tok_lst or NULL on error
*/
-t_tok_lst *tok_lst_new_until(enum e_tok tag, char *content, size_t n)
+t_tok_lst *tok_lst_new_until(
+ enum e_tok tag, char *content, size_t n)
{
t_tok_lst *ret;
if ((ret = malloc(sizeof(t_tok_lst))) == NULL)
return (NULL);
if (content == NULL)
- ret->content = NULL;
+ ret->content = NULL;
else if ((ret->content = ft_strndup(content, n)) == NULL)
{
free(ret);
@@ -48,7 +50,8 @@ void tok_lst_push_back(t_tok_lst **tokens, t_tok_lst *pushed)
ft_lstpush_back((t_ftlst**)tokens, (t_ftlst*)pushed);
}
-t_tok_lst *tok_lst_push_front(t_tok_lst **tokens, t_tok_lst *pushed)
+t_tok_lst *tok_lst_push_front(
+ t_tok_lst **tokens, t_tok_lst *pushed)
{
if (pushed == NULL)
return (NULL);
@@ -56,7 +59,8 @@ t_tok_lst *tok_lst_push_front(t_tok_lst **tokens, t_tok_lst *pushed)
return (*tokens);
}
-void tok_lst_pop_front(t_tok_lst **tokens, void (*del)(void*))
+void tok_lst_pop_front(
+ t_tok_lst **tokens, void (*del)(void*))
{
ft_lstpop_front((t_ftlst**)tokens, del);
}