From 90457ec703de0d8c44c031e494072d0d72ae4b9d Mon Sep 17 00:00:00 2001 From: AntoHesse Date: Thu, 16 Feb 2017 17:02:37 +0100 Subject: [PATCH] before pull --- 42sh/includes/parser.h | 10 ++++++++++ 42sh/src/parser/build_tree.c | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 42sh/src/parser/build_tree.c diff --git a/42sh/includes/parser.h b/42sh/includes/parser.h index 14293032..66ac51df 100644 --- a/42sh/includes/parser.h +++ b/42sh/includes/parser.h @@ -215,6 +215,16 @@ typedef struct s_stackmatch t_stackmatch; extern t_stackmatch g_stackmatch[]; +struct s_treematch g_treemacth[]; +{ + t_type token; + void (*add)(t_btree **ast, t_type ) +}; + +typedef struct s_treematch t_treematch; + +extern t_treematch g_treematch[]; + int ft_parse(t_btree **ast, t_list **token); int produce_sym(t_sym stack, t_sym *new_sym, t_list **lst); int eval_sym(t_sym stack, t_sym new_sym); diff --git a/42sh/src/parser/build_tree.c b/42sh/src/parser/build_tree.c new file mode 100644 index 00000000..1ba0fd59 --- /dev/null +++ b/42sh/src/parser/build_tree.c @@ -0,0 +1,12 @@ +#include "parser.h" + +t_treematch g_treematch[] = +{ + TK_WORD, + +int build_tree(t_btree **ast) +{ + int i; + + i = 0; + while (g