lexing while_clause, passage en buffer dynamique au readscript todo tomorrow
This commit is contained in:
parent
bcaa2fb943
commit
91ac485169
1 changed files with 28 additions and 0 deletions
28
42sh/src/lexer/lexer_while.c
Normal file
28
42sh/src/lexer/lexer_while.c
Normal 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));
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue