merge
This commit is contained in:
commit
bb4ffa50e5
9 changed files with 45 additions and 255 deletions
|
|
@ -1,235 +1,5 @@
|
|||
[31m[38;5;34m.[0m[31m[38;5;160mx[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;160mx[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;160mx[0m[31m[38;5;34m.[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1m21sh/misc/002-simple-command-line[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that the Shell is able to execute a simple command line that contains separators `;`, pipes `|`, and a right redirection `>`.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -rf "./size"
|
||||
02: rm -rf "TOKEN201703241733"
|
||||
03: echo '^'$(echo TOKEN201703241733_FILE_TOKEN201703241733_STDOUT | wc -c)'$' > "./size"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: mkdir TOKEN201703241733 ; cd TOKEN201703241733 ; touch TOKEN201703241733_FILE ; ls -1 ; ls | cat | wc -c > TOKEN201703241733_STDOUT ; cat TOKEN201703241733_STDOUT[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `TOKEN201703241733_FILE$`[0m
|
||||
[31m[38;5;160m FAILURE expected_to match_each_regex_of_file `./size`[0m
|
||||
[38;5;239m 01: TOKEN201703241733_FILE
|
||||
02: 94296 redirect_great.c 24 3 1
|
||||
03: 23[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1m21sh/redirections/outputs/truncating/001-creates-file-if-not-exits[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The right redirection `>` opens the file with the oflag `O_CREAT` so that the file is created if it does not exists.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f new_file[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ./write_on_stdout TOKEN201703241733 >new_file[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;34m SUCCESS expected_to create_file `new_file` matching_regex `TOKEN201703241733`[0m
|
||||
[31m[38;5;160m FAILURE expected_to create_file `new_file` with_nb_of_lines `1`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1m21sh/redirections/outputs/truncating/002-truncates-file-if-exists[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The right redirection `>` opens the file with the oflag `O_TRUNC` so that the file size is truncated to 0 before writing in it.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: ./write_on_stdout TOKEN201703241733_first >truncated_file[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ./write_on_stdout TOKEN201703241733_second >truncated_file[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex TOKEN201703241733_second[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;34m SUCCESS expected_to create_file `truncated_file` matching_regex `TOKEN201703241733_second`[0m
|
||||
[31m[38;5;34m SUCCESS expected_to create_file `truncated_file` not_matching_regex `TOKEN201703241733_first`[0m
|
||||
[31m[38;5;160m FAILURE expected_to create_file `truncated_file` with_nb_of_lines `1`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1m21sh/redirections/outputs/truncating/003-whitespace-before-filename[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The file name for a right redirection can be specified closely to the character `>` or in a separated field.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f "new_file"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ./write_on_stdout TOKEN201703241733 > new_file[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;34m SUCCESS expected_to create_file `new_file` matching_regex `TOKEN201703241733`[0m
|
||||
[31m[38;5;160m FAILURE expected_to create_file `new_file` with_nb_of_lines `1`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1m21sh/redirections/outputs/truncating/multiple/004-together[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m A right redirection can be associated to the twice outputs by using `&>...`, that means `redirect stdout and stderr to ...`.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f "new_file_stderr_and_stdout"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ./write_on_stdout_and_stderr TOKEN201703241733_1 TOKEN201703241733_2 &>new_file_stderr_and_stdout[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to_not match_regex `TOKEN201703241733_1`[0m
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733_2`[0m
|
||||
[38;5;239m 01: TOKEN201703241733_1[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733_1`[0m
|
||||
[31m[38;5;160m FAILURE expected_to_not match_regex `TOKEN201703241733_2`[0m
|
||||
[38;5;239m 01: TOKEN201703241733_2[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr_and_stdout` matching_regex `TOKEN201703241733_1$`[0m
|
||||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr_and_stdout` matching_regex `TOKEN201703241733_2$`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1m21sh/redirections/outputs/truncating/multiple/005-together-with-whitespaces[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m A right redirection can be associated to the twice outputs by using `&>...`, that means `redirect stdout and stderr to ...`.
|
||||
In this test, we specify the file name in a separate field.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f new_file_stderr_and_stdout[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ./write_on_stdout_and_stderr TOKEN201703241733_1 TOKEN201703241733_2 &> new_file_stderr_and_stdout[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;160m FAILURE expected_to_not match_regex `TOKEN201703241733_1`[0m
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733_2`[0m
|
||||
[38;5;239m 01: TOKEN201703241733_1[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733_1`[0m
|
||||
[31m[38;5;160m FAILURE expected_to_not match_regex `TOKEN201703241733_2`[0m
|
||||
[38;5;239m 01: TOKEN201703241733_2[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr_and_stdout` matching_regex `TOKEN201703241733_1$`[0m
|
||||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr_and_stdout` matching_regex `TOKEN201703241733_2$`[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1m21sh/redirections/outputs/truncating/stderr/001-works[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that redirecting the standard error STDERR to a file `2>` works. In this test, the binary writes a token on each standard and error output, so that only the STDOUT is outputted and STDERR is written in a file `new_file_stderr`.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f "./new_file_stderr"[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ./write_on_stdout_and_stderr TOKEN201703241733_STDOUT TOKEN201703241733_STDERR 2>new_file_stderr[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to match_regex `TOKEN201703241733_STDOUT`[0m
|
||||
[38;5;239m 01: TOKEN201703241733_STDOUT[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex `TOKEN201703241733_STDERR`[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;34m SUCCESS expected_to create_file `new_file_stderr` matching_regex `TOKEN201703241733_STDERR`[0m
|
||||
[31m[38;5;160m FAILURE expected_to create_file `new_file_stderr` with_nb_of_lines 1[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1m21sh/redirections/outputs/truncating/stdout/001-with-explicit-fd[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check if '1>' redirect STDIN to a file.
|
||||
We are using echo with one argument. The output should NOT return anything on the standard output.[0m
|
||||
|
||||
Before test:
|
||||
[38;5;239m 01: rm -f new_file[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: /bin/echo TOKEN1 1>new_file[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to_not match_regex TOKEN1[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;34m SUCCESS expected_to create_file new_file matching_regex TOKEN1[0m
|
||||
[31m[38;5;160m FAILURE expected_to create_file new_file with_nb_of_lines 1[0m
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
[37;1m21sh/separators/semicolon/003-parse-error-empty-inline-command[0m [31m[38;5;160m(FAILED)[0m
|
||||
|
||||
Description:
|
||||
[38;5;239m The purpose of this test is to check that using the simicolon separator `;` with empty commands results in error.[0m
|
||||
|
||||
STDIN:
|
||||
[38;5;239m 01: ./write_on_stdout TOKEN201703241733 ; ; ./exit_with_status 42[0m
|
||||
|
||||
STDOUT:
|
||||
[31m[38;5;34m SUCCESS expected_to be_empty[0m
|
||||
[38;5;239m (no output)[0m
|
||||
|
||||
STDERR:
|
||||
[31m[38;5;34m SUCCESS expected_to_not be_empty[0m
|
||||
[31m[38;5;34m SUCCESS might match_regex `([Ss]yntax|[Pp]arse) error`[0m
|
||||
[38;5;239m 01: syntax error near unexpected token `;'[0m
|
||||
|
||||
MISC:
|
||||
[31m[38;5;34m SUCCESS expected_to_not exit_with_status `42`[0m
|
||||
[31m[38;5;160m FAILURE expected_to_not exit_with_status `0`[0m
|
||||
[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m[31m[38;5;34m.[0m
|
||||
|
||||
Total tests: 36
|
||||
Total failed tests: 9
|
||||
Total failed tests: 0
|
||||
Total pending tests: 0
|
||||
|
|
|
|||
23
42sh/VAR
Normal file
23
42sh/VAR
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
$TOKEN201703241737_NAME
|
||||
21sh_error
|
||||
42ShellTester
|
||||
42sh
|
||||
42sh_error
|
||||
Makefile
|
||||
README.md
|
||||
STDBUG
|
||||
VAR
|
||||
auteur
|
||||
donovan_segaults_06-02
|
||||
file
|
||||
includes
|
||||
libft
|
||||
minishell_error
|
||||
new_file
|
||||
objs
|
||||
pdf
|
||||
sample
|
||||
scriptheader.sh
|
||||
src
|
||||
update_makefile.sh
|
||||
write_on_stdout_and_stderr
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/04 16:31:18 by wescande #+# #+# */
|
||||
/* Updated: 2017/03/23 03:18:41 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/24 18:38:35 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ typedef struct s_bquote
|
|||
*/
|
||||
char **glob(char *str, unsigned char *esc,
|
||||
unsigned char *dbl_esc, int do_match);
|
||||
void esc_print(char *str, unsigned char *esc);
|
||||
void esc_print(int fd, char *str, unsigned char *esc);
|
||||
int word_is_assignment(char **content);
|
||||
void *tab_esc_copy(void *content);
|
||||
char *get_output(char *command);
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/17 15:38:14 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/15 18:12:49 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/24 18:39:17 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
void esc_print(char *str, unsigned char *esc)
|
||||
void esc_print(int fd, char *str, unsigned char *esc)
|
||||
{
|
||||
char *cur;
|
||||
|
||||
|
|
@ -20,10 +20,10 @@ void esc_print(char *str, unsigned char *esc)
|
|||
while (*cur)
|
||||
{
|
||||
if (is_char_esc(esc, str, cur))
|
||||
ft_printf("\\%c", *cur);
|
||||
ft_dprintf(fd, "\\%c", *cur);
|
||||
else
|
||||
ft_printf("%c", *cur);
|
||||
ft_dprintf(fd, "%c", *cur);
|
||||
++cur;
|
||||
}
|
||||
ft_printf("\n");
|
||||
ft_dprintf(fd, "\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/06 16:09:27 by wescande #+# #+# */
|
||||
/* Updated: 2017/03/07 12:07:53 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/24 18:42:15 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -32,12 +32,12 @@ static void insert_var(t_glob *gl, char *pos, char *name, char *content)
|
|||
gl->pat = ft_strjoinf(ft_strjoin(s1, content), s2, 1);
|
||||
new_esc = calc_expand_esc(gl->esc, ft_strlen(s1),
|
||||
(int[2]){ft_strlen(content), 1},
|
||||
(int[2]){delta, ft_strlen(s2)});
|
||||
(int[2]){delta - 1, ft_strlen(s2)});
|
||||
ft_memdel((void **)&gl->esc);
|
||||
gl->esc = new_esc;
|
||||
new_esc = calc_expand_esc(gl->esc2, ft_strlen(s1),
|
||||
(int[2]){ft_strlen(content), 1},
|
||||
(int[2]){delta, ft_strlen(s2)});
|
||||
(int[2]){delta - 1, ft_strlen(s2)});
|
||||
ft_memdel((void **)&gl->esc2);
|
||||
gl->esc2 = new_esc;
|
||||
ft_strdel(&s1);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/28 14:39:01 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/24 18:39:53 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/24 19:23:12 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,11 +18,8 @@ void token_print(t_list *lst)
|
|||
|
||||
while (lst)
|
||||
{
|
||||
if (lst->content)
|
||||
{
|
||||
token = lst->content;
|
||||
if ((token = lst->content))
|
||||
DG("token : %s data [%s]", read_state(token->type), token->data);
|
||||
}
|
||||
lst = lst->next;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/24 18:55:21 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/24 19:23:34 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -46,16 +46,12 @@ static int handle_instruction(t_list **token, t_btree **ast)
|
|||
return (ret);
|
||||
if (do_lexer_routine(token, stream) > 0)
|
||||
continue ;
|
||||
/* token_print(*token); */
|
||||
/* exit(1); */
|
||||
if ((ret = do_parser_routine(token, ast)) == 1
|
||||
&& SH_NO_INTERACTIVE(data->opts))
|
||||
return (ret);
|
||||
else if (ret > 0)
|
||||
break ;
|
||||
}
|
||||
btree_print(3, *ast, ft_putast);
|
||||
/* exit(1); */
|
||||
if (data->parser.state == SUCCESS && ft_exec(ast) < 0)
|
||||
exit(1);
|
||||
else if (data->parser.state != SUCCESS)
|
||||
|
|
@ -73,7 +69,6 @@ int main(int ac, char **av, char **env)
|
|||
t_btree *ast;
|
||||
|
||||
g_argv = av;
|
||||
DG("----------------------");
|
||||
if (shell_init(ac, av, env) != 0)
|
||||
return (1);
|
||||
token = NULL;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/11 15:58:38 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/24 17:23:26 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/24 19:09:05 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -380,15 +380,18 @@ int aggregate_sym(t_list **stack, t_sym *new_sym, t_parstate *state)
|
|||
return (1);
|
||||
i = -1;
|
||||
head = (*stack)->content;
|
||||
DG("aggregate head %s && sym %s", read_state(*head), read_state(*new_sym));
|
||||
while (g_aggrematch[++i].top)
|
||||
if (*new_sym == g_aggrematch[i].top
|
||||
&& MATCH_STACK(*head, g_aggrematch[i].under))
|
||||
{
|
||||
DG("MATH: %s", read_state(g_aggrematch[i].new_sym));
|
||||
*new_sym = g_aggrematch[i].new_sym;
|
||||
if (g_aggrematch[i].erase_sym)
|
||||
{
|
||||
pop_stack(stack, g_aggrematch[i].erase_sym);
|
||||
head = (*stack)->content;
|
||||
DG("stack after pop %s", read_state(*head));
|
||||
}
|
||||
if (eval_sym(stack, *new_sym) && !(*state = ERROR))
|
||||
return (1);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/11 16:11:21 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/24 17:23:52 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/24 19:11:10 by ariard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -905,6 +905,7 @@ static t_stackmatch g_stackmatch[] =
|
|||
{WHILE_CLAUSE, NEWLINE_LIST},
|
||||
{WHILE_CLAUSE, SEQUENCE},
|
||||
{WHILE_CLAUSE, TK_DO},
|
||||
{WHILE_CLAUSE, TK_PAREN_OPEN},
|
||||
{WHILE_CLAUSE, TK_PAREN_CLOSE},
|
||||
{WHILE_CLAUSE, TK_WHILE},
|
||||
{WHILE_CLAUSE, TK_LBRACE},
|
||||
|
|
@ -1287,6 +1288,7 @@ int eval_sym(t_list **stack, t_sym new_sym)
|
|||
return (1);
|
||||
head = (*stack)->content;
|
||||
i = 0;
|
||||
DG("eval head %s && sym %s", read_state(*head), read_state(new_sym));
|
||||
while (g_stackmatch[i].top)
|
||||
{
|
||||
if (new_sym == g_stackmatch[i].top && *head == g_stackmatch[i].under)
|
||||
|
|
|
|||
Loading…
Reference in a new issue