lexing while_clause, passage en buffer dynamique au readscript todo tomorrow

This commit is contained in:
ariard@student.42.fr 2017-01-26 01:01:09 +01:00
parent bcaa2fb943
commit 91ac485169

View file

@ -0,0 +1,28 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lexer_loop.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/25 21:58:12 by ariard #+# #+# */
/* Updated: 2017/01/26 00:58:57 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
#include "lexer.h"
int lexer_while(t_list **alst, char *str)
{
t_token *token;
token = (*alst)->content;
if (ft_strncmp(str, "while", 5) == 0)
token->type = TK_WHILE;
else if (ft_isalnum(*str))
{
token_append(token, *str);
return (ft_tokenize(alst, str + 1, WORD));
}
return (ft_tokenize(&(*alst)->next, str + 6, LIST));
}