42-archive/42sh/src/parser/get_sub_instruction.c
ariard@student.42.fr c0977b20ff until exec ok
2017-02-06 21:02:37 +01:00

33 lines
1.5 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_instruction2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/05 22:05:26 by ariard #+# #+# */
/* Updated: 2017/02/06 20:37:24 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
#include "parser.h"
int get_sub_instruction(t_btree **ast, t_list **start, t_list **lst)
{
t_token *token;
token = (*lst)->content;
if (token->type & TK_NEWLINE)
return (parse_separator(ast, start, lst));
else if (token->type & (TK_WHILE | TK_UNTIL))
return (parse_while(ast, start, lst));
else if (token->type & TK_IF)
return (parse_if(ast, start, lst));
else if (token->type & TK_ELIF)
return (parse_elif(ast, start, lst));
else if (token->type & TK_ELSE)
return (parse_else(ast, start, lst));
else if (token->type & TK_SEMI)
return (parse_separator(ast, start, lst));
return (0);
}