main clean

This commit is contained in:
ariard@student.42.fr 2017-02-21 18:34:31 +01:00
parent 07c2101df4
commit 7856564ecb
4 changed files with 9 additions and 31 deletions

2
42sh/.gitignore vendored
View file

@ -11,3 +11,5 @@ debug
*.swo
*.o
*.swn
STDBUG
STDEBUG

View file

@ -1,21 +0,0 @@
 shell_init.c 28 interactive shell settings
 ft_parse.c 34 new sym CMD_NAME
 eval_sym.c 637eval head LINEBREAK && sym CMD_NAME
 eval_sym.c 637eval head LINEBREAK && sym CMD_SUPERIOR
 build_tree.c 60 func TK : 'TK_WORD' TK : 'TK_WORD'
 add_cmd.c 21 add cmd
 ft_parse.c 34 new sym LINEBREAK
 eval_sym.c 637eval head CMD_SUPERIOR && sym LINEBREAK
 eval_sym.c 637eval head CMD_SUPERIOR && sym SEPARATOR_OP
 eval_sym.c 637eval head CMD_SUPERIOR && sym SEPARATOR
 eval_sym.c 637eval head LINEBREAK && sym END_COMMAND
 eval_sym.c 637eval head LINEBREAK && sym PIPE_SEQUENCE
 eval_sym.c 637eval head LINEBREAK && sym PIPELINE
 eval_sym.c 637eval head LINEBREAK && sym AND_OR
 eval_sym.c 637eval head LINEBREAK && sym LIST
 eval_sym.c 637eval head LINEBREAK && sym COMPLETE_COMMAND
 eval_sym.c 637eval head LINEBREAK && sym COMPLETE_COMMANDS
 eval_sym.c 637eval head NULL && sym PROGRAM
 ft_parse.c 34 new sym LINEBREAK
 eval_sym.c 637eval head PROGRAM && sym LINEBREAK
 ft_exec.c 53 match : TK_WORD and TK_WORD

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */
/* Updated: 2017/02/21 18:11:01 by ariard ### ########.fr */
/* Updated: 2017/02/21 18:15:31 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
/* Updated: 2017/02/21 18:13:49 by ariard ### ########.fr */
/* Updated: 2017/02/21 18:33:24 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -40,12 +40,9 @@ int handle_instruction(int fd)
return (1);
//token_print(token);
if (get_lexer_stack(lexer))
return (1);
if (!token)
return (0);
ft_add_str_in_history(lexer.str);
continue;
if (ft_parse(&ast, &token, &parser))
return (1);
continue;
if (parser.state == SUCCESS)
break;
if (parser.state == ERROR)
@ -54,7 +51,7 @@ int handle_instruction(int fd)
btree_print(STDBUG, ast, &ft_putast);
if (ft_exec(&ast))
return (1);
ft_strdel(&lexer.str);
ft_add_str_in_history(lexer.str);
return (1);
}
@ -69,9 +66,7 @@ int get_input_fd()
/* { */
/* } */
else
{
return (open(shell_get_avdata(), O_RDONLY));
}
}
int main(int ac, char **av)
@ -84,6 +79,8 @@ int main(int ac, char **av)
fd = get_input_fd();
while (handle_instruction(fd))
{
// lexer_clean;
// parser_clean;
;
}
return (0);