pour merge

This commit is contained in:
wescande 2017-03-07 15:12:20 +01:00
parent 7ae114fd55
commit b2af159f64
16 changed files with 175 additions and 60 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */ /* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
/* Updated: 2017/03/06 19:16:30 by ariard ### ########.fr */ /* Updated: 2017/03/07 14:41:58 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -48,15 +48,60 @@
# define EXEC_IS_IF_BRANCH(j) (j & EXEC_IF_BRANCH) # define EXEC_IS_IF_BRANCH(j) (j & EXEC_IF_BRANCH)
# define EXEC_IS_CASE_BRANCH(j) (j & EXEC_CASE_BRANCH) # define EXEC_IS_CASE_BRANCH(j) (j & EXEC_CASE_BRANCH)
# include "libft.h" # include "../libft/includes/libft.h"
# include "types.h" # include "types.h"
# include "job_control.h" # include "job_control.h"
struct s_process struct s_data_cmd
{ {
char **av; char **av;
char *path; char *path;
t_execf *execf; t_execf *execf;
};
struct s_data_cond
{
t_btree *condition;
t_btree *content;
};
struct s_data_list
{
char *word;
t_ld *list_word;
t_btree *content;
};
union u_process_data
{
struct s_data_cmd cmd;
struct s_data_cond d_while;
struct s_data_cond d_if;
struct s_data_cond d_else;
struct s_data_cond d_elif;
struct s_data_list d_for;
// struct s_data_cond case;
};
typedef union u_process_data t_pdata;
typedef struct s_data_cond t_data_while;
typedef struct s_data_cond t_data_if;
struct s_process
{
//normal_cmd
// char **av;
// char *path;
// t_execf *execf;
//while, if, elif ....
// t_btree *condition;
// t_btree *content;
//for => utilisation du av et du content
// char **av;
// t_btree *content;
t_pdata data;
pid_t pid; pid_t pid;
int fdin; int fdin;
int fdout; int fdout;

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 13:09:57 by jhalford #+# #+# */ /* Created: 2016/12/13 13:09:57 by jhalford #+# #+# */
/* Updated: 2017/03/07 11:05:55 by gwojda ### ########.fr */ /* Updated: 2017/03/07 14:39:17 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -38,7 +38,7 @@ t_execf *is_builtin(t_process *p)
i = -1; i = -1;
while (g_builtin[++i].name) while (g_builtin[++i].name)
{ {
if (ft_strcmp(g_builtin[i].name, p->av[0]) == 0) if (ft_strcmp(g_builtin[i].name, p->data.cmd.av[0]) == 0)
return (g_builtin[i].f); return (g_builtin[i].f);
} }
return (NULL); return (NULL);

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */ /* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */
/* Updated: 2017/03/06 18:51:58 by ariard ### ########.fr */ /* Updated: 2017/03/07 15:03:54 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */ /* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/30 17:33:53 by ariard #+# #+# */ /* Created: 2017/01/30 17:33:53 by ariard #+# #+# */
/* Updated: 2017/03/06 12:27:23 by wescande ### ########.fr */ /* Updated: 2017/03/07 14:33:10 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */ /* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */
/* Updated: 2017/03/06 18:08:06 by ariard ### ########.fr */ /* Updated: 2017/03/07 14:33:06 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */ /* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
/* Updated: 2017/03/06 16:20:54 by wescande ### ########.fr */ /* Updated: 2017/03/07 14:43:48 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -23,15 +23,15 @@ int launch_process(t_process *p)
{ {
if (process_redirect(p)) if (process_redirect(p))
return (1); return (1);
set_exitstatus((*p->execf)(p->path, p->av, data_singleton()->env), 1); set_exitstatus((*p->data.cmd.execf)(p->data.cmd.path, p->data.cmd.av, data_singleton()->env), 1);
return (1); return (1);
} }
p->attrs &= ~PROCESS_STATE_MASK; p->attrs &= ~PROCESS_STATE_MASK;
p->attrs |= PROCESS_RUNNING; p->attrs |= PROCESS_RUNNING;
if (p->attrs & (PROCESS_BINARY | PROCESS_SCRIPT) if (p->attrs & (PROCESS_BINARY | PROCESS_SCRIPT)
&& access(p->path, X_OK) == -1) && access(p->data.cmd.path, X_OK) == -1)
{ {
ft_dprintf(2, "{red}%s: permission denied: %s{eoc}\n", SHELL_NAME, p->av[0]); ft_dprintf(2, "{red}%s: permission denied: %s{eoc}\n", SHELL_NAME, p->data.cmd.av[0]);
set_exitstatus(126, 1); set_exitstatus(126, 1);
return (1); return (1);
} }
@ -40,7 +40,7 @@ int launch_process(t_process *p)
{ {
if (p->attrs & PROCESS_UNKNOWN) if (p->attrs & PROCESS_UNKNOWN)
{ {
ft_dprintf(2, "{red}%s: command not found: %s{eoc}\n", SHELL_NAME, p->av[0]); ft_dprintf(2, "{red}%s: command not found: %s{eoc}\n", SHELL_NAME, p->data.cmd.av[0]);
exit(127); exit(127);
} }
process_setgroup(p, 0); process_setgroup(p, 0);
@ -48,9 +48,9 @@ int launch_process(t_process *p)
if (process_redirect(p)) if (process_redirect(p))
exit (1); exit (1);
if (p->attrs & PROCESS_BUILTIN) if (p->attrs & PROCESS_BUILTIN)
exit((*p->execf)(p->path, p->av, data_singleton()->env)); exit((*p->data.cmd.execf)(p->data.cmd.path, p->data.cmd.av, data_singleton()->env));
(*p->execf)(p->path, p->av, data_singleton()->env); (*p->data.cmd.execf)(p->data.cmd.path, p->data.cmd.av, data_singleton()->env);
ft_dprintf(2, "{red}%s: internal execve error on %s{eoc}\n", SHELL_NAME, p->av[0]); ft_dprintf(2, "{red}%s: internal execve error on %s{eoc}\n", SHELL_NAME, p->data.cmd.av[0]);
} }
else if (pid > 0) else if (pid > 0)
{ {

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/07 17:44:22 by jhalford #+# #+# */ /* Created: 2017/02/07 17:44:22 by jhalford #+# #+# */
/* Updated: 2017/03/06 12:29:17 by wescande ### ########.fr */ /* Updated: 2017/03/07 14:36:21 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,9 +14,9 @@
void process_reset(t_process *p) void process_reset(t_process *p)
{ {
p->av = NULL; // p->av = NULL;
p->path = NULL; // p->path = NULL;
p->execf = NULL; // p->execf = NULL;
p->pid = 0; p->pid = 0;
/* p->fdin = STDIN; */ /* p->fdin = STDIN; */
/* p->fdout = STDOUT; */ /* p->fdout = STDOUT; */
@ -24,4 +24,6 @@ void process_reset(t_process *p)
p->redirs = NULL; p->redirs = NULL;
p->status = -1; p->status = -1;
p->attrs = 0; p->attrs = 0;
// p->condition = NULL;
// p->content = NULL;
} }

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 17:07:10 by jhalford #+# #+# */ /* Created: 2016/12/13 17:07:10 by jhalford #+# #+# */
/* Updated: 2017/03/06 12:26:01 by wescande ### ########.fr */ /* Updated: 2017/03/07 14:42:01 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,23 +14,23 @@
int process_setexec(t_process *p) int process_setexec(t_process *p)
{ {
p->path = NULL; p->data.cmd.path = NULL;
if ((p->execf = is_builtin(p))) if ((p->data.cmd.execf = is_builtin(p)))
p->attrs |= PROCESS_BUILTIN; p->attrs |= PROCESS_BUILTIN;
else if (ft_strchr(p->av[0], '/')) else if (ft_strchr(p->data.cmd.av[0], '/'))
{ {
p->execf = &execve; p->data.cmd.execf = &execve;
p->attrs |= PROCESS_SCRIPT; p->attrs |= PROCESS_SCRIPT;
p->path = ft_strdup(p->av[0]); p->data.cmd.path = ft_strdup(p->data.cmd.av[0]);
} }
else if (ft_hash(p)) else if (ft_hash(p))
{ {
p->execf = &execve; p->data.cmd.execf = &execve;
p->attrs |= PROCESS_BINARY; p->attrs |= PROCESS_BINARY;
} }
else else
{ {
p->execf = NULL; p->data.cmd.execf = NULL;
p->attrs |= PROCESS_UNKNOWN; p->attrs |= PROCESS_UNKNOWN;
return (1); return (1);
} }

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/05 14:54:45 by jhalford #+# #+# */ /* Created: 2017/03/05 14:54:45 by jhalford #+# #+# */
/* Updated: 2017/03/06 18:41:01 by ariard ### ########.fr */ /* Updated: 2017/03/07 15:07:44 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -28,8 +28,6 @@ int set_process(t_process *p, t_btree *ast)
|| (EXEC_IS_OR_IF(exec->attrs) || (EXEC_IS_OR_IF(exec->attrs)
&& ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0") == 0)) && ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0") == 0))
return (1); return (1);
if (!(p->av = token_to_argv(cmd->token, 1)))
return (1);
fds[PIPE_WRITE] = STDOUT; fds[PIPE_WRITE] = STDOUT;
fds[PIPE_READ] = STDIN; fds[PIPE_READ] = STDIN;
if (op == TK_AMP) if (op == TK_AMP)
@ -41,14 +39,8 @@ int set_process(t_process *p, t_btree *ast)
p->fdout = fds[PIPE_WRITE]; p->fdout = fds[PIPE_WRITE];
exec->fdin = fds[PIPE_READ]; exec->fdin = fds[PIPE_READ];
p->redirs = ft_lstmap(cmd->redir, ft_id); p->redirs = ft_lstmap(cmd->redir, ft_id);
t_list *tmp = p->redirs; if (set_process_map(p, ast, cmd))
while (tmp) return (1);
{
t_redir *toto = tmp->content;
printf("IIIIIIIIIIIIIIIIIIIIIII%lld |%d| {%s}\n", toto->type, toto->n, toto->word);
tmp= tmp->next;
}
process_setexec(p);
if (exec->control_count) if (exec->control_count)
p->attrs |= PROCESS_CONTROL; p->attrs |= PROCESS_CONTROL;
return (0); return (0);

View file

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* set_process_cmd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 15:06:05 by wescande #+# #+# */
/* Updated: 2017/03/07 15:07:39 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
#include "exec.h"
int set_process_cmd(t_process *p, t_btree *ast, t_cmd *cmd)
{
if (!(p->data.cmd.av = token_to_argv(cmd->token, 1)))
return (1);
process_setexec(p);
return (0);
}

View file

@ -0,0 +1,51 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* set_process_map.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 15:08:12 by wescande #+# #+# */
/* Updated: 2017/03/07 15:11:17 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
#include "exec.h"
t_setprocessmap g_setprocessmap[] =
{
{TK_NEWLINE, &exec_semi},
{TK_SEMI, &exec_semi},
{TK_AMP, &exec_ampersand},
{TK_AND_IF, &exec_and_if},
{TK_OR_IF, &exec_or_if},
{TK_PIPE, &exec_pipe},
{TK_WHILE, &exec_while},
{TK_IF, &exec_if},
{TK_ELIF, &exec_elif},
{TK_ELSE, &exec_else},
{TK_UNTIL, &exec_until},
{TK_FOR, &exec_for},
{TK_CASE, &exec_case},
{TK_PAREN_OPEN, &exec_case_branch},
{TK_ASSIGNEMENT_WORD, &exec_var},
/* {TK_SUBSHELL, &exec_}, */
{CMD, &exec_cmd},
{0, 0},
};
int set_process_map(t_process *p, t_btree *ast, t_cmd *cmd)
{
int i;
i = 0;
if (!ast)
return (0);
while (g_execmap[i].type)
{
if (p->type == g_setprocessmap[i].type)
return ((*g_setprocessmap[i].f)(p, ast, cmd));
i++;
}
return (0);
}

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/18 11:20:11 by gwojda #+# #+# */ /* Created: 2017/02/18 11:20:11 by gwojda #+# #+# */
/* Updated: 2017/03/04 18:51:01 by ariard ### ########.fr */ /* Updated: 2017/03/07 14:44:52 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -18,11 +18,11 @@ int ft_add_hash(t_process *p)
t_hash hash; t_hash hash;
if (!(hash.path = ft_findexec( if (!(hash.path = ft_findexec(
ft_getenv(data_singleton()->env, "PATH"), p->av[0]))) ft_getenv(data_singleton()->env, "PATH"), p->data.cmd.av[0])))
return (0); return (0);
hash.key = ft_strdup(p->av[0]); hash.key = ft_strdup(p->data.cmd.av[0]);
id = ft_hash_str(p->av[0]); id = ft_hash_str(p->data.cmd.av[0]);
ft_lsteadd(&(g_hash[id]), ft_lstnew(&hash, sizeof(t_hash))); ft_lsteadd(&(g_hash[id]), ft_lstnew(&hash, sizeof(t_hash)));
p->path = ft_strdup(hash.path); p->data.cmd.path = ft_strdup(hash.path);
return (1); return (1);
} }

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/18 11:08:40 by gwojda #+# #+# */ /* Created: 2017/02/18 11:08:40 by gwojda #+# #+# */
/* Updated: 2017/02/18 16:42:12 by gwojda ### ########.fr */ /* Updated: 2017/03/07 14:45:20 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -18,12 +18,12 @@ int ft_is_hash(t_process *p)
t_list *ref; t_list *ref;
int id; int id;
id = ft_hash_str(p->av[0]); id = ft_hash_str(p->data.cmd.av[0]);
list = g_hash[id]; list = g_hash[id];
ref = list; ref = list;
while (list) while (list)
{ {
if (!ft_strcmp(((t_hash *)list->content)->key, p->av[0])) if (!ft_strcmp(((t_hash *)list->content)->key, p->data.cmd.av[0]))
{ {
if (access(((t_hash *)list->content)->path, X_OK)) if (access(((t_hash *)list->content)->path, X_OK))
{ {
@ -31,7 +31,7 @@ int ft_is_hash(t_process *p)
ft_lstdelone(&list, &ft_hash_free); ft_lstdelone(&list, &ft_hash_free);
return (0); return (0);
} }
p->path = ft_strdup(((t_hash *)list->content)->path); p->data.cmd.path = ft_strdup(((t_hash *)list->content)->path);
return (1); return (1);
} }
ref = list; ref = list;

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/09 13:05:55 by jhalford #+# #+# */ /* Created: 2017/01/09 13:05:55 by jhalford #+# #+# */
/* Updated: 2017/03/06 12:32:05 by wescande ### ########.fr */ /* Updated: 2017/03/07 14:46:12 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -47,11 +47,11 @@ static void process_format_com_long(t_list **plist)
else if (p->attrs & PROCESS_SUBSHELL) else if (p->attrs & PROCESS_SUBSHELL)
{ {
ft_putstr("( "); ft_putstr("( ");
ft_putstr(p->av[2]); // ft_putstr(p->data.cmd.av[2]);
ft_putstr(" )"); ft_putstr(" )");
} }
else else
ft_sstrprint(p->av, ' '); ft_sstrprint(p->data.cmd.av, ' ');
if ((*plist)->next) if ((*plist)->next)
ft_putstr(" |"); ft_putstr(" |");
(*plist) = (*plist)->next; (*plist) = (*plist)->next;
@ -77,11 +77,11 @@ static void process_format_com_short(t_list **plist, t_flag state)
else if (p->attrs & PROCESS_SUBSHELL) else if (p->attrs & PROCESS_SUBSHELL)
{ {
ft_putstr("( "); ft_putstr("( ");
ft_putstr(p->av[2]); ft_putstr(p->data.cmd.av[2]);
ft_putstr(" )"); ft_putstr(" )");
} }
else else
ft_sstrprint(p->av, ' '); ft_sstrprint(p->data.cmd.av, ' ');
if ((*plist)->next) if ((*plist)->next)
ft_putstr(" | "); ft_putstr(" | ");
(*plist) = (*plist)->next; (*plist) = (*plist)->next;

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */ /* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */
/* Updated: 2017/03/05 16:00:27 by jhalford ### ########.fr */ /* Updated: 2017/03/07 14:46:41 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -18,8 +18,8 @@ void process_free(void *content, size_t content_size)
(void)content_size; (void)content_size;
p = content; p = content;
ft_strdel(&p->path); ft_strdel(&p->data.cmd.path);
ft_sstrfree(p->av); ft_sstrfree(p->data.cmd.av);
/* ft_lstdel(&p->redirs, ft_lst_cfree); */ ft_lstdel(&p->redirs, ft_lst_cfree);
free(p); free(p);
} }

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/03 12:06:45 by jhalford #+# #+# */ /* Created: 2016/12/03 12:06:45 by jhalford #+# #+# */
/* Updated: 2017/03/05 18:03:34 by ariard ### ########.fr */ /* Updated: 2017/03/07 13:55:25 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -28,6 +28,7 @@ int lexer_number(t_list **alst, t_lexer *lexer)
else if (ft_isdigit(lexer->str[lexer->pos]) else if (ft_isdigit(lexer->str[lexer->pos])
&& ft_isdigit(lexer->str[lexer->pos + 1])) && ft_isdigit(lexer->str[lexer->pos + 1]))
{ {
DG();
token_append(token, lexer, 0, 0); token_append(token, lexer, 0, 0);
lexer->pos++; lexer->pos++;
return (lexer_number(alst, lexer)); return (lexer_number(alst, lexer));
@ -36,13 +37,16 @@ int lexer_number(t_list **alst, t_lexer *lexer)
&& (lexer->str[lexer->pos + 1] == '>' && (lexer->str[lexer->pos + 1] == '>'
|| lexer->str[lexer->pos + 1] == '<')) || lexer->str[lexer->pos + 1] == '<'))
{ {
DG();
token_append(token, lexer, 0, 0); token_append(token, lexer, 0, 0);
lexer->pos++; lexer->pos++;
return (lexer_lex(&(*alst)->next, lexer)); return (lexer_lex(&(*alst)->next, lexer));
} }
else else
{ {
DG();
token->type = TK_WORD; token->type = TK_WORD;
lexer->state = DEFAULT;
token_append(token, lexer, 0, 0); token_append(token, lexer, 0, 0);
lexer->pos++; lexer->pos++;
return (lexer_lex(alst, lexer)); return (lexer_lex(alst, lexer));