scission apres les TOKEN_GREAT / LESS / GREATAND / LESSAND

This commit is contained in:
william 2017-03-05 18:42:00 +01:00
parent 0d5408b114
commit 08f437a573
5 changed files with 32 additions and 30 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/03 12:06:35 by jhalford #+# #+# */ /* Created: 2016/12/03 12:06:35 by jhalford #+# #+# */
/* Updated: 2017/02/25 20:12:58 by ariard ### ########.fr */ /* Updated: 2017/03/05 18:20:02 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -36,10 +36,7 @@ int lexer_great(t_list **alst, t_lexer *lexer)
lexer->state = DEFAULT; lexer->state = DEFAULT;
return (lexer_lex(&(*alst)->next, lexer)); return (lexer_lex(&(*alst)->next, lexer));
} }
else token->type = TK_GREAT;
{ lexer->state = DEFAULT;
token->type = TK_GREAT; return (lexer_lex(&(*alst)->next, lexer));
lexer->state = DEFAULT;
return (lexer_lex(&(*alst)->next, lexer));
}
} }

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/03 11:56:58 by jhalford #+# #+# */ /* Created: 2016/12/03 11:56:58 by jhalford #+# #+# */
/* Updated: 2017/02/25 20:11:03 by ariard ### ########.fr */ /* Updated: 2017/03/05 18:23:55 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -18,19 +18,22 @@ int lexer_greatand(t_list **alst, t_lexer *lexer)
token = (*alst)->content; token = (*alst)->content;
token->type = TK_GREATAND; token->type = TK_GREATAND;
if (ft_isdigit(lexer->str[lexer->pos])) /* if (ft_isdigit(lexer->str[lexer->pos]))
{ {
token_append(token, lexer, 0, 0); // token_append(token, lexer, 0, 0);
lexer->pos++; // lexer->pos++;
return (lexer_greatand(alst, lexer)); // DG();
}
else if (lexer->str[lexer->pos] == '-')
{
token_append(token, lexer, 0, 0);
lexer->pos++;
lexer->state = DEFAULT; lexer->state = DEFAULT;
return (lexer_lex(&(*alst)->next, lexer)); return (lexer_lex(&(*alst)->next, lexer));
} }
else if (lexer->str[lexer->pos] == '-')
{
// token_append(token, lexer, 0, 0);
// lexer->pos++;
lexer->state = DEFAULT;
return (lexer_lex(&(*alst)->next, lexer));
}*/
lexer->state = DEFAULT; lexer->state = DEFAULT;
return (lexer_lex(alst, lexer)); return (lexer_lex(&(*alst)->next, lexer));
//return (lexer_lex(alst, lexer));
} }

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/03 12:06:53 by jhalford #+# #+# */ /* Created: 2016/12/03 12:06:53 by jhalford #+# #+# */
/* Updated: 2017/02/25 20:11:17 by ariard ### ########.fr */ /* Updated: 2017/03/05 18:19:48 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -37,10 +37,7 @@ int lexer_less(t_list **alst, t_lexer *lexer)
ft_lsteadd(&lexer->heredoc_stack, ft_lstnew(alst, sizeof(alst))); ft_lsteadd(&lexer->heredoc_stack, ft_lstnew(alst, sizeof(alst)));
return (lexer_lex(&(*alst)->next, lexer)); return (lexer_lex(&(*alst)->next, lexer));
} }
else token->type = TK_LESS;
{ lexer->state = DEFAULT;
token->type = TK_LESS; return (lexer_lex(&(*alst)->next, lexer));
lexer->state = DEFAULT;
return (lexer_lex(&(*alst)->next, lexer));
}
} }

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/03 11:58:51 by jhalford #+# #+# */ /* Created: 2016/12/03 11:58:51 by jhalford #+# #+# */
/* Updated: 2017/02/25 20:11:10 by ariard ### ########.fr */ /* Updated: 2017/03/05 18:05:39 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -18,11 +18,14 @@ int lexer_lessand(t_list **alst, t_lexer *lexer)
token = (*alst)->content; token = (*alst)->content;
token->type = TK_LESSAND; token->type = TK_LESSAND;
if (ft_isdigit(lexer->str[lexer->pos])) lexer->state = DEFAULT;
return (lexer_lex(&(*alst)->next, lexer));
/* if (ft_isdigit(lexer->str[lexer->pos]))
{ {
token_append(token, lexer, 0, 0); token_append(token, lexer, 0, 0);
lexer->pos++; lexer->pos++;
return (lexer_lessand(alst, lexer)); lexer->state = DEFAULT;
return (lexer_lex(&(*alst)->next, lexer));
} }
else if (lexer->str[lexer->pos] == '-') else if (lexer->str[lexer->pos] == '-')
{ {
@ -32,5 +35,5 @@ int lexer_lessand(t_list **alst, t_lexer *lexer)
return (lexer_lex(&(*alst)->next, lexer)); return (lexer_lex(&(*alst)->next, lexer));
} }
lexer->state = DEFAULT; lexer->state = DEFAULT;
return (lexer_lex(alst, lexer)); return (lexer_lex(alst, lexer));*/
} }

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/09 17:08:51 by jhalford #+# #+# */ /* Created: 2017/02/09 17:08:51 by jhalford #+# #+# */
/* Updated: 2017/03/05 16:28:15 by jhalford ### ########.fr */ /* Updated: 2017/03/05 18:32:09 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -51,6 +51,8 @@ int lexer_lex(t_list **alst, t_lexer *lexer)
{ {
t_token *token; t_token *token;
ft_putnbr(__LINE__);
ft_putendl(__FILE__);
if (lexer->str[lexer->pos] == 0) if (lexer->str[lexer->pos] == 0)
return (lexer_end(alst, lexer)); return (lexer_end(alst, lexer));
if (!*alst) if (!*alst)