From 73b4cc306001358e26585271fb98ba41b3b8bb46 Mon Sep 17 00:00:00 2001 From: "ariard@student.42.fr" Date: Tue, 31 Jan 2017 22:12:49 +0100 Subject: [PATCH] resolution empty tree + nested loop + while error lexing --- 42sh/includes/exec.h | 4 +- 42sh/includes/lexer.h | 15 +++++-- 42sh/includes/minishell.h | 3 +- 42sh/includes/parser.h | 4 +- 42sh/sample/4lines.sh | 6 +-- 42sh/sample/while.sh | 21 ++++++++-- 42sh/src/exec/ast_free.c | 2 +- 42sh/src/exec/exec_default.c | 23 +++++++++++ 42sh/src/exec/exec_semi.c | 2 +- 42sh/src/exec/exec_while.c | 2 +- 42sh/src/exec/ft_exec.c | 3 +- 42sh/src/exec/loop_exec.c | 2 +- 42sh/src/lexer/ft_tokenize.c | 5 ++- 42sh/src/lexer/get_reserved_words.c | 9 +++-- .../lexer/{lexer_do_group.c => lexer_do.c} | 23 +++++------ 42sh/src/lexer/lexer_done.c | 39 +++++++++++++++++++ 42sh/src/lexer/lexer_list.c | 16 ++++---- 42sh/src/lexer/token_free.c | 2 +- 42sh/src/main/data_init.c | 4 +- 42sh/src/main/main.c | 2 +- 42sh/src/main/shell_init.c | 2 +- 42sh/src/main/shell_script.c | 2 +- 42sh/src/parser/ft_parse.c | 2 +- 42sh/src/parser/parse_done.c | 2 +- 42sh/src/parser/parse_list.c | 2 +- 42sh/src/parser/parse_newline.c | 9 ++++- 26 files changed, 153 insertions(+), 53 deletions(-) create mode 100644 42sh/src/exec/exec_default.c rename 42sh/src/lexer/{lexer_do_group.c => lexer_do.c} (66%) create mode 100644 42sh/src/lexer/lexer_done.c diff --git a/42sh/includes/exec.h b/42sh/includes/exec.h index 3791999c..00305b5d 100644 --- a/42sh/includes/exec.h +++ b/42sh/includes/exec.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */ -/* Updated: 2017/01/30 22:32:57 by ariard ### ########.fr */ +/* Updated: 2017/01/31 19:34:10 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -73,6 +73,8 @@ extern t_execmap g_execmap[]; int ft_exec(t_btree **ast); +int exec_default(t_btree **ast); + int exec_semi(t_btree **ast); int exec_ampersand(t_btree **ast); int exec_or_if(t_btree **ast); diff --git a/42sh/includes/lexer.h b/42sh/includes/lexer.h index eb3ba0e9..2872c1f1 100644 --- a/42sh/includes/lexer.h +++ b/42sh/includes/lexer.h @@ -6,13 +6,20 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */ -/* Updated: 2017/01/30 23:41:17 by ariard ### ########.fr */ +/* Updated: 2017/01/31 21:55:48 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LEXER_H # define LEXER_H +struct s_nest +{ + long long do_group; +}; + +typedef struct s_nest t_nest; + # include "minishell.h" typedef long long t_type; @@ -64,7 +71,8 @@ enum e_lexstate VAR, SPECIAL, WHILE, - DO_GROUP, + DO, + DONE, LIST, COMMENT, }; @@ -116,7 +124,8 @@ int lexer_backslash(t_list **alst, char *str); int lexer_var(t_list **alst, char *str); int lexer_special(t_list **alst, char *str); int lexer_while(t_list **alst, char *str); -int lexer_do_group(t_list **alst, char *str); +int lexer_do(t_list **alst, char *str); +int lexer_done(t_list **alst, char *str); int lexer_list(t_list **alst, char *str); int lexer_comment(t_list **alst, char *str); diff --git a/42sh/includes/minishell.h b/42sh/includes/minishell.h index bd86829c..5f3ebf1d 100644 --- a/42sh/includes/minishell.h +++ b/42sh/includes/minishell.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */ -/* Updated: 2017/01/30 23:10:05 by ariard ### ########.fr */ +/* Updated: 2017/01/31 21:59:25 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -66,6 +66,7 @@ struct s_data t_exec exec; t_jobc jobc; t_script script; + t_nest nest; }; extern t_stof g_builtins[]; diff --git a/42sh/includes/parser.h b/42sh/includes/parser.h index d9271c02..72c2046d 100644 --- a/42sh/includes/parser.h +++ b/42sh/includes/parser.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/01 12:15:54 by jhalford #+# #+# */ -/* Updated: 2017/01/30 18:52:54 by ariard ### ########.fr */ +/* Updated: 2017/01/31 19:31:01 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -58,6 +58,7 @@ struct s_astnode extern t_parser g_parser[]; int ft_parse(t_list **list_ast, t_btree **ast, t_list **token); + int parse_newline(t_list **list_ast, t_btree **ast, t_list **start, t_list **lst); int parse_separator(t_list **list_ast, t_btree **ast, @@ -88,4 +89,5 @@ int parse_done(t_list **list_ast, t_btree **ast, t_list **start, t_list **lst); int parse_list(t_list **list_ast, t_btree **ast, t_list **start, t_list **lst); + #endif diff --git a/42sh/sample/4lines.sh b/42sh/sample/4lines.sh index 999b725d..2ef2d5ba 100644 --- a/42sh/sample/4lines.sh +++ b/42sh/sample/4lines.sh @@ -1,4 +1,2 @@ -ls | wc -l > file1 -cd ; pwd | wc -l ; echo "bonjour" -ls -l > file2 -pwd ; echo "hello world" +ls | cat + diff --git a/42sh/sample/while.sh b/42sh/sample/while.sh index 84f20c5e..8c6fb2e9 100644 --- a/42sh/sample/while.sh +++ b/42sh/sample/while.sh @@ -1,5 +1,20 @@ -echo "begin script" +echo "begin loop" while [ 1 ] -do sleep 1 ; echo "hello 42sh" +do + echo "inner loop1" + while [ 1 ] + do + echo "love 42" + done + echo "inner loop2" + while [ 1 ] + do + echo "inner loop2-1" + while [ 1 ] + do + echo "hello world" + done + echo "salut monde" + done done -echo "end script" +echo "end loop" diff --git a/42sh/src/exec/ast_free.c b/42sh/src/exec/ast_free.c index b0b3f592..12e06dba 100644 --- a/42sh/src/exec/ast_free.c +++ b/42sh/src/exec/ast_free.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/05 11:50:51 by jhalford #+# #+# */ -/* Updated: 2017/01/11 17:50:03 by jhalford ### ########.fr */ +/* Updated: 2017/01/31 18:49:37 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/exec_default.c b/42sh/src/exec/exec_default.c new file mode 100644 index 00000000..57489149 --- /dev/null +++ b/42sh/src/exec/exec_default.c @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* exec_default.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: ariard +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2017/01/31 19:29:59 by ariard #+# #+# */ +/* Updated: 2017/01/31 19:57:44 by ariard ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "exec.h" + +int exec_default(t_btree **ast) +{ + t_process *p; + + p = &data_singleton()->exec.process; + if (!(p->script & SCRIPT_LOOP)) + btree_delone(ast, &ast_free); + return (0); +} diff --git a/42sh/src/exec/exec_semi.c b/42sh/src/exec/exec_semi.c index 2ab2b3d2..9cabc19f 100644 --- a/42sh/src/exec/exec_semi.c +++ b/42sh/src/exec/exec_semi.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/30 20:52:05 by jhalford #+# #+# */ -/* Updated: 2017/01/30 23:25:33 by ariard ### ########.fr */ +/* Updated: 2017/01/31 19:31:59 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/exec_while.c b/42sh/src/exec/exec_while.c index d6aa3e24..75285598 100644 --- a/42sh/src/exec/exec_while.c +++ b/42sh/src/exec/exec_while.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/30 17:33:53 by ariard #+# #+# */ -/* Updated: 2017/01/30 23:41:55 by ariard ### ########.fr */ +/* Updated: 2017/01/31 20:45:41 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/ft_exec.c b/42sh/src/exec/ft_exec.c index 16bd6e16..8251c16e 100644 --- a/42sh/src/exec/ft_exec.c +++ b/42sh/src/exec/ft_exec.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */ -/* Updated: 2017/01/30 23:15:15 by ariard ### ########.fr */ +/* Updated: 2017/01/31 20:00:23 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,6 +14,7 @@ t_execmap g_execmap[] = { + {TK_NEWLINE, &exec_default}, {TK_AND_IF, &exec_and_if}, {TK_OR_IF, &exec_or_if}, {TK_SEMI, &exec_semi}, diff --git a/42sh/src/exec/loop_exec.c b/42sh/src/exec/loop_exec.c index c33f48be..cf285ee4 100644 --- a/42sh/src/exec/loop_exec.c +++ b/42sh/src/exec/loop_exec.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/30 21:02:10 by ariard #+# #+# */ -/* Updated: 2017/01/30 23:17:24 by ariard ### ########.fr */ +/* Updated: 2017/01/31 19:27:49 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/ft_tokenize.c b/42sh/src/lexer/ft_tokenize.c index cff6e516..4e09ed79 100644 --- a/42sh/src/lexer/ft_tokenize.c +++ b/42sh/src/lexer/ft_tokenize.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/10 13:37:11 by jhalford #+# #+# */ -/* Updated: 2017/01/27 12:50:21 by ariard ### ########.fr */ +/* Updated: 2017/01/31 21:08:54 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -30,7 +30,8 @@ int (*g_lexer[])(t_list **alst, char *str) = &lexer_var, &lexer_special, &lexer_while, - &lexer_do_group, + &lexer_do, + &lexer_done, &lexer_list, &lexer_comment, }; diff --git a/42sh/src/lexer/get_reserved_words.c b/42sh/src/lexer/get_reserved_words.c index f317f792..ea064d56 100644 --- a/42sh/src/lexer/get_reserved_words.c +++ b/42sh/src/lexer/get_reserved_words.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/26 00:07:05 by ariard #+# #+# */ -/* Updated: 2017/01/26 18:47:52 by ariard ### ########.fr */ +/* Updated: 2017/01/31 21:11:47 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,8 +16,9 @@ t_lexstate get_reserved_words(char *str) { if (ft_strncmp(str, "while", 5) == 0) return (WHILE); - else if (ft_strncmp(str, "done", 4) == 0 - || ft_strncmp(str, "do" , 2) == 0) - return (DO_GROUP); + else if (ft_strncmp(str, "done", 4) == 0 && ft_isalpha(*(str + 4)) == 0) + return (DONE); + else if (ft_strncmp(str, "do" , 2) == 0 && ft_isalpha(*(str + 2)) == 0) + return (DO); return (0); } diff --git a/42sh/src/lexer/lexer_do_group.c b/42sh/src/lexer/lexer_do.c similarity index 66% rename from 42sh/src/lexer/lexer_do_group.c rename to 42sh/src/lexer/lexer_do.c index 56681183..f6c20aeb 100644 --- a/42sh/src/lexer/lexer_do_group.c +++ b/42sh/src/lexer/lexer_do.c @@ -6,25 +6,25 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/26 00:48:48 by ariard #+# #+# */ -/* Updated: 2017/01/26 18:49:32 by ariard ### ########.fr */ +/* Updated: 2017/01/31 21:57:33 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ #include "lexer.h" -int lexer_do_group(t_list **alst, char *str) +int lexer_do(t_list **alst, char *str) { t_token *token; t_lexstate state; - int type; + t_nest *nest; - type = (str[0] == 'd' && str[1] == 'o' && str[2] != 'n' ? - 2 : 4); + nest = &data_singleton()->nest; if (*alst) { - if (ft_is_delim_list(*(str + type)) || *(str + type) == ' ') - return (lexer_do_group(&(*alst)->next, str)); - return (ft_tokenize(alst, str + 1, LIST)); + nest->do_group++; + if (nest->do_group == 1) + return (lexer_do(&(*alst)->next, str)); + return (ft_tokenize(alst, str, LIST)); } else { @@ -32,7 +32,8 @@ int lexer_do_group(t_list **alst, char *str) *alst = ft_lstnew(token, sizeof(*token)); } token = (*alst)->content; - token->type = (type == 2 ? TK_DO : TK_DONE); - state = (token->type == TK_DO) ? LIST : DEFAULT; - return (ft_tokenize(&(*alst)->next, str + type, state)); + token->type = TK_DO; + state = LIST; +// data_singleton()->scope |= (token->type == TK_DO) ? IN_LIST : OUT_LIST; + return (ft_tokenize(&(*alst)->next, str + 2, state)); } diff --git a/42sh/src/lexer/lexer_done.c b/42sh/src/lexer/lexer_done.c new file mode 100644 index 00000000..19705849 --- /dev/null +++ b/42sh/src/lexer/lexer_done.c @@ -0,0 +1,39 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* lexer_done.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: ariard +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2017/01/31 20:49:09 by ariard #+# #+# */ +/* Updated: 2017/01/31 21:57:46 by ariard ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "lexer.h" + +int lexer_done(t_list **alst, char *str) +{ + t_token *token; + t_lexstate state; + t_nest *nest; + + nest = &data_singleton()->nest; + if (*alst) + { + nest->do_group--; + if (nest->do_group == 0) + return (lexer_done(&(*alst)->next, str)); + return (ft_tokenize(alst, str, LIST)); + } + else + { + token = token_init(); + *alst = ft_lstnew(token, sizeof(*token)); + } + token = (*alst)->content; + token->type = TK_DONE; + state = DEFAULT; +// data_singleton()->scope |= (token->type == TK_DO) ? IN_LIST : OUT_LIST; + return (ft_tokenize(&(*alst)->next, str + 4, state)); +} diff --git a/42sh/src/lexer/lexer_list.c b/42sh/src/lexer/lexer_list.c index 3fe84e51..0ff80acd 100644 --- a/42sh/src/lexer/lexer_list.c +++ b/42sh/src/lexer/lexer_list.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/26 00:55:33 by ariard #+# #+# */ -/* Updated: 2017/01/30 23:14:45 by ariard ### ########.fr */ +/* Updated: 2017/01/31 22:05:36 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,7 +15,6 @@ int lexer_list(t_list **alst, char *str) { t_token *token; - char lim; token = (*alst)->content; token->type = TK_LIST; @@ -23,14 +22,15 @@ int lexer_list(t_list **alst, char *str) { if (ft_is_delim_list(*str)) { - lim = *str++; + token_append(token, *str++); while (ft_is_delim(*str) || *str == '\n') str++; - if (ft_strncmp(str, "done", 4) == 0 - || ft_strncmp(str, "do", 2) == 0) - return (ft_tokenize(alst, str, DO_GROUP)); - else - token_append(token, lim); + if (ft_strncmp(str, "done", 4) == 0 && (ft_is_delim_list(*(str + 4)) + || *(str + 4) == ' ')) + return (ft_tokenize(alst, str, DONE)); + else if (ft_strncmp(str, "do", 2) == 0 && (ft_is_delim_list(*(str + 2)) + || *(str + 2) == ' ')) + return (ft_tokenize(alst, str, DO)); } token_append(token, *str++); } diff --git a/42sh/src/lexer/token_free.c b/42sh/src/lexer/token_free.c index b0b9b190..88287de8 100644 --- a/42sh/src/lexer/token_free.c +++ b/42sh/src/lexer/token_free.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 12:07:30 by jhalford #+# #+# */ -/* Updated: 2017/01/26 22:25:08 by ariard ### ########.fr */ +/* Updated: 2017/01/31 18:41:48 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/data_init.c b/42sh/src/main/data_init.c index 8ca93754..c69faea1 100644 --- a/42sh/src/main/data_init.c +++ b/42sh/src/main/data_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */ -/* Updated: 2017/01/23 22:37:43 by ariard ### ########.fr */ +/* Updated: 2017/01/31 21:50:31 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,6 +24,8 @@ int data_init(void) data->env = ft_sstrdup(environ); data->opts = SHELL_OPTS_JOBC; + data->nest.do_group = 0; + data->exec.process.path = NULL; data->exec.process.av = NULL; data->exec.process.fdin = STDIN; diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index 7cbf39ee..5a7ecd69 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */ -/* Updated: 2017/01/30 20:45:01 by ariard ### ########.fr */ +/* Updated: 2017/01/31 21:25:39 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/shell_init.c b/42sh/src/main/shell_init.c index 14066b58..d2051cbb 100644 --- a/42sh/src/main/shell_init.c +++ b/42sh/src/main/shell_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */ -/* Updated: 2017/01/23 22:35:46 by ariard ### ########.fr */ +/* Updated: 2017/01/31 20:02:04 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/shell_script.c b/42sh/src/main/shell_script.c index e525e758..2ec9a76c 100644 --- a/42sh/src/main/shell_script.c +++ b/42sh/src/main/shell_script.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/22 23:06:34 by ariard #+# #+# */ -/* Updated: 2017/01/30 23:13:44 by ariard ### ########.fr */ +/* Updated: 2017/01/31 21:55:11 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/ft_parse.c b/42sh/src/parser/ft_parse.c index d9da288d..3d795414 100644 --- a/42sh/src/parser/ft_parse.c +++ b/42sh/src/parser/ft_parse.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/30 17:14:58 by jhalford #+# #+# */ -/* Updated: 2017/01/30 17:14:19 by ariard ### ########.fr */ +/* Updated: 2017/01/31 18:38:01 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/parse_done.c b/42sh/src/parser/parse_done.c index 349c6a78..83a5f6f1 100644 --- a/42sh/src/parser/parse_done.c +++ b/42sh/src/parser/parse_done.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/30 16:36:28 by ariard #+# #+# */ -/* Updated: 2017/01/30 17:15:00 by ariard ### ########.fr */ +/* Updated: 2017/01/31 19:36:49 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/parse_list.c b/42sh/src/parser/parse_list.c index f55d8336..965fed17 100644 --- a/42sh/src/parser/parse_list.c +++ b/42sh/src/parser/parse_list.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/30 16:34:21 by ariard #+# #+# */ -/* Updated: 2017/01/30 23:38:15 by ariard ### ########.fr */ +/* Updated: 2017/01/31 20:20:13 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/parse_newline.c b/42sh/src/parser/parse_newline.c index f4129f9e..cf636e26 100644 --- a/42sh/src/parser/parse_newline.c +++ b/42sh/src/parser/parse_newline.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/26 19:26:41 by ariard #+# #+# */ -/* Updated: 2017/01/30 20:02:09 by ariard ### ########.fr */ +/* Updated: 2017/01/31 19:35:54 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,7 +16,12 @@ int parse_newline(t_list **list_ast, t_btree **ast, t_list **start, t_list **lst) { t_list *temp; - + t_astnode *node; + t_token *token; + + token = (*lst)->content; + node = (*ast)->item; + node->type = TK_NEWLINE; temp = (*lst)->next; (*lst)->next = NULL; ft_lst_delif(start, (*lst)->content, &ft_addrcmp, &token_free);