Commit 3229f519 authored by Seblu's avatar Seblu

--

correction bug de non initialisation des redirection dans ast_red.c, cela plant	 realloc.
--
support complet de la libefence dans configure.ac (ajout du header automatique)
--
ajout le prompt PS2 lorsque l'on parse sur plusieurs ligne dans le parser
--
gestion correct du case
--
ajout fonction destruct du noeud sans recurstion
correction des leaks dans les fonctions de destruction
--
ajout des possibilitees d'un parser ll1 dans le lexer
--
parse d'une fonction
--
parse correct de toute la grammaire !!
--
moulette de test
--
prompt a desormais le nom du program par defaut
--
correction bug dans le lexer pour les chaines sur plusieurs lignes
--
lexer previent le parser en cas d'erreur de lex !
parent 08f97490
Sebastien Luttringer
\ No newline at end of file
Sebastien LUTTRINGER
----
Revoir les free dans le parser a cause de ast_destruct qui rentre dans les fils.
il faudrait ecrire des fonctions qui ne le fasse pas! Voir aussi au niveau de la
boucle general si ast_destruct est appele alors qu'une erreur de parse est surevenur
(le cas echeant, le supprimer)
----
Voir probleme de syntax que j'accepte lorsque un EOF apparait avant une quote
fermante. Le token est valide alors que sous bash non
----
ajotuer le prompt PS3 lorsque l'on parse sur plusieurs ligne
----
parse du case
----
parse du funcdec
----
corriger le bug
./42sh </etc/bash/bashrc
\ No newline at end of file
- Lexer
-- Voir probleme de syntax que j'accepte lorsque un EOF apparait avant une quote
fermante. Le token est valide alors que sous bash non. faire un test avant.
Maintenant il renvoie EOF a la place du token.
- Parser
-- aliases
-- history
\ No newline at end of file
......@@ -16,16 +16,16 @@ AC_CANONICAL_HOST
case $host_os in
*netbsd*)
CFLAGS='-Wall -Werror -W -ansi -pedantic'
CFLAGS='-Wall -W -ansi -pedantic -D_XOPEN_SOURCE=600'
;;
*osf*)
CFLAGS='-Wall -Werror -W -ansi -pedantic -D_XOPEN_SOURCE=600'
CFLAGS='-Wall -W -ansi -pedantic -D_XOPEN_SOURCE=600'
;;
*solaris*)
CFLAGS='-Wall -Werror -W -ansi -pedantic -D_XOPEN_SOURCE=600'
CFLAGS='-Wall -W -ansi -pedantic -D_XOPEN_SOURCE=600'
;;
*linux*)
CFLAGS='-Wall -Werror -W -std=c99 -pedantic -D_XOPEN_SOURCE=600'
CFLAGS='-Wall -Wextra -std=c99 -pedantic -D_XOPEN_SOURCE=600'
;;
*)
pl="`uname -s`"
......@@ -89,6 +89,17 @@ AC_CHECK_HEADERS([limits.h])
dnl Memo:
dnl AC ARG WITH(package, help-string, [action-if-given], [action-if-not-given])
AC_ARG_WITH([noerror],
[AS_HELP_STRING([--with-noerror], [Warning dont create compilation error])],
[dnl action-if-given
true
],
[dnl action-if-not-given
CFLAGS="$CFLAGS -Werror"
]
)
AC_ARG_WITH([debug],
[AS_HELP_STRING([--with-debug], [use -g and don't use -DNDEBUG -O3])],
[dnl action-if-given
......@@ -103,12 +114,14 @@ AC_ARG_WITH([efence],
[AS_HELP_STRING([--with-efence], [link with lib efence])],
[dnl action-if-given
LDFLAGS="$LDFLAGS -lefence"
CFLAGS="$CFLAGS -include stdlib.h -include efence.h"
],
[dnl action-if-not-given
LDFLAGS="$LDFLAGS -static"
]
)
AC_SUBST([CFLAGS])
AC_SUBST([LDFLAGS])
......
......@@ -5,7 +5,7 @@
** Login <seblu@epita.fr>
**
** Started on Sun Jul 30 04:40:03 2006 Seblu
** Last update Wed Oct 11 14:58:42 2006 seblu
** Last update Tue Oct 17 17:14:49 2006 seblu
*/
#ifndef AST_H_
......@@ -106,7 +106,7 @@ typedef struct cmd_node
** Binary ast node
** Generic node, it's a contener !
** T_PIPE, T_SEP* , T_AND, T_OR : binary operator
** T_BANG : unary operator but ts_bin_op with right pointer is always NULL
** T_BANG : unary operator
*/
typedef struct bin_node
{
......@@ -158,6 +158,7 @@ typedef union node_item
s_for_node child_for;
s_case_node child_case;
s_while_node child_while;
s_red_node child_red;
s_cmd_node child_cmd;
s_bin_node child_and;
s_bin_node child_or;
......@@ -167,7 +168,6 @@ typedef union node_item
s_bin_node child_pipe;
s_bin_node child_sep;
s_bin_node child_sepand;
s_red_node child_red;
} u_node_item;
/*
......@@ -205,6 +205,14 @@ void ast_print_node(s_ast_node *ast, FILE *fs, unsigned int *node_id);
*/
void ast_destruct(s_ast_node *ast);
/*!
** Destroy node and only this node. All childs will survive.
**
** @param ast mother node to destroy
**
*/
void ast_destruct_node(s_ast_node *ast);
/*!
** Create an if ast node
**
......@@ -227,7 +235,14 @@ s_ast_node *ast_if_create(s_ast_node *cond,
void ast_if_print(s_ast_node *node, FILE *fs, unsigned int *node_id);
/*!
** Destruct an if ast node
** Destruct an if ast node. Don't destruct child nodes.
**
** @param node node to free
*/
void ast_if_destruct_node(s_ast_node *node);
/*!
** Destruct an if ast node. Destruct child nodes.
**
** @param node node to destroy
*/
......@@ -257,7 +272,14 @@ s_ast_node *ast_for_create(char *varname,
void ast_for_print(s_ast_node *node, FILE *fs, unsigned *node_id);
/*!
** Destruct a for ast node
** Destruct a for ast node. Don't destruct child nodes.
**
** @param node node to free
*/
void ast_for_destruct_node(s_ast_node *node);
/*!
** Destruct a for ast node. Destruct child nodes.
**
** @param node node to destroy
*/
......@@ -294,7 +316,14 @@ void ast_case_add_item(s_ast_node *node,
void ast_case_print(s_ast_node *node, FILE *fs, unsigned *node_id);
/*!
** Destruct a case ast node
** Destruct a case ast node. Don't destruct child nodes.
**
** @param node node to free
*/
void ast_case_destruct_node(s_ast_node *node);
/*!
** Destruct a case ast node. Destruct child node.
**
** @param node node to destroy
*/
......@@ -320,12 +349,62 @@ s_ast_node *ast_while_create(s_ast_node *cond, s_ast_node *exec);
void ast_while_print(s_ast_node *node, FILE *fs, unsigned int *node_id);
/*!
** Destruct a while ast node
** Destruct a while ast node. Don't destruct child nodes.
**
** @param node node to free
*/
void ast_while_destruct_node(s_ast_node *node);
/*!
** Destruct a while ast node. Destruct all child nodes.
**
** @param node node to destroy
*/
void ast_while_destruct(s_ast_node *node);
/*!
** Create a redirection ast node
**
** @return the node
*/
s_ast_node *ast_red_create(void);
/*!
** Add a redirection to a redirection node
**
** @param node node where add
** @param type type of redirection
** @param fd fd parameter of redirection
** @param word file or word parameter of redirection
*/
void ast_red_add(s_ast_node *node,
e_red_type type,
int fd,
char *word);
/*!
** Print an ast red node
**
** @param ast ast node to add to file
** @param fs file stream where print ast
** @param node_id first free node id
*/
void ast_red_print(s_ast_node *node, FILE *fs, unsigned int *node_id);
/*!
** Destruct a red ast node. Don't destruct child nodes.
**
** @param node node to free
*/
void ast_red_destruct_node(s_ast_node *node);
/*!
** Destruct a red ast node. Destruct child nodes.
**
** @param node node to destroy
*/
void ast_red_destruct(s_ast_node *node);
/*!
** Create a cmd ast node
**
......@@ -359,7 +438,14 @@ void ast_cmd_add_prefix(s_ast_node *node, char *assignment_word);
void ast_cmd_print(s_ast_node *node, FILE *fs, unsigned int *node_id);
/*!
** Destruct a cmd node
** Destruct a cmd ast node. Don't destruct child nodes.
**
** @param node node to free
*/
void ast_cmd_destruct_node(s_ast_node *node);
/*!
** Destruct a cmd node. All child nodes will be destruct.
**
** @param node node to destroy
*/
......@@ -385,7 +471,14 @@ s_ast_node *ast_and_create(s_ast_node *lhs, s_ast_node *rhs);
void ast_and_print(s_ast_node *node, FILE *fs, unsigned int *node_id);
/*!
** Destruct an and (&&) node
** Destruct an and ast node. Don't destruct child nodes.
**
** @param node node to free
*/
void ast_and_destruct_node(s_ast_node *node);
/*!
** Destruct an and (&&) node. Destruct all child nodes.
**
** @param node node to destroy
*/
......@@ -411,7 +504,14 @@ s_ast_node *ast_or_create(s_ast_node *lhs, s_ast_node *rhs);
void ast_or_print(s_ast_node *node, FILE *fs, unsigned int *node_id);
/*!
** Destruct an or (||) node
** Destruct an or ast node. Don't destruct child nodes.
**
** @param node node to free
*/
void ast_or_destruct_node(s_ast_node *node);
/*!
** Destruct an or (||) ast node. Destruct child nodes.
**
** @param node node to destroy
*/
......@@ -436,7 +536,14 @@ s_ast_node *ast_subshell_create(s_ast_node *child);
void ast_subshell_print(s_ast_node *node, FILE *fs, unsigned int *node_id);
/*!
** Destruct a subshell (()) node
** Destruct a subshell (()) ast node. Don't destruct child nodes.
**
** @param node node to free
*/
void ast_subshell_destruct_node(s_ast_node *node);
/*!
** Destruct a subshell (()) ast node. Destruct child nodes.
**
** @param node node to destroy
*/
......@@ -462,7 +569,14 @@ s_ast_node *ast_funcdec_create(char *name, s_ast_node *body);
void ast_funcdec_print(s_ast_node *node, FILE *fs, unsigned *node_id);
/*!
** Destruct a funcdec ast node
** Destruct a funcdec ast node. Don't destruct child nodes.
**
** @param node node to free
*/
void ast_funcdec_destruct_node(s_ast_node *node);
/*!
** Destruct a funcdec ast node. Destruct child nodes.
**
** @param node node to destroy
*/
......@@ -487,7 +601,14 @@ s_ast_node *ast_bang_create(s_ast_node *child);
void ast_bang_print(s_ast_node *node, FILE *fs, unsigned int *node_id);
/*!
** Destruct a bang (!) node
** Destruct a bang (!) ast node. Don't destruct child nodes.
**
** @param node node to destroy
*/
void ast_bang_destruct_node(s_ast_node *node);
/*!
** Destruct a bang (!) ast node. Destruct child nodes.
**
** @param node node to destroy
*/
......@@ -512,6 +633,12 @@ s_ast_node *ast_pipe_create(s_ast_node *lhs, s_ast_node *rhs);
*/
void ast_pipe_print(s_ast_node *node, FILE *fs, unsigned int *node_id);
/*!
** Destruct a pipe (|) ast node. Don't destruct child nodes.
**
** @param node node to destroy
*/
void ast_pipe_destruct_node(s_ast_node *node);
/*!
** Destruct a pipe (|) node
**
......@@ -539,7 +666,13 @@ s_ast_node *ast_sep_create(s_ast_node *lhs, s_ast_node *rhs);
void ast_sep_print(s_ast_node *node, FILE *fs, unsigned int *node_id);
/*!
** Destruct a sep (;) node
** Destruct a sep (;) ast node. Don't destruct child nodes.
**
** @param node node to destroy
*/
void ast_sep_destruct_node(s_ast_node *node);
/*!
** Destruct a sep (;) ast node. Destruct child nodes.
**
** @param node node to destroy
*/
......@@ -565,46 +698,17 @@ s_ast_node *ast_sepand_create(s_ast_node *lhs, s_ast_node *rhs);
void ast_sepand_print(s_ast_node *node, FILE *fs, unsigned int *node_id);
/*!
** Destruct a sepand (&) node
** Destruct a sepand (&) ast node. Don't destruct child nodes.
**
** @param node node to destroy
*/
void ast_sepand_destruct(s_ast_node *node);
/*!
** Create a redirection ast node
**
** @return the node
*/
s_ast_node *ast_red_create(void);
/*!
** Add a redirection to a redirection node
**
** @param node node where add
** @param type type of redirection
** @param fd fd parameter of redirection
** @param word file or word parameter of redirection
*/
void ast_red_add(s_ast_node *node,
e_red_type type,
int fd,
char *word);
/*!
** Print an ast red node
**
** @param ast ast node to add to file
** @param fs file stream where print ast
** @param node_id first free node id
*/
void ast_red_print(s_ast_node *node, FILE *fs, unsigned int *node_id);
void ast_sepand_destruct_node(s_ast_node *node);
/*!
** Destruct a red node
** Destruct a sepand (&) ast node. Destruct child nodes.
**
** @param node node to destroy
*/
void ast_red_destruct(s_ast_node *node);
void ast_sepand_destruct(s_ast_node *node);
#endif /* !AST_H_ */
......@@ -5,7 +5,7 @@
** Login <seblu@epita.fr>
**
** Started on Thu Aug 3 02:41:37 2006 Seblu
** Last update Tue Sep 26 17:45:16 2006 Seblu
** Last update Tue Oct 17 16:50:32 2006 seblu
*/
#include "ast.h"
......@@ -36,6 +36,13 @@ void ast_and_print(s_ast_node *node, FILE *fs, unsigned int *node_id)
fprintf(fs, "%u -> %u\n", cur_id, rhs_id);
}
void ast_and_destruct_node(s_ast_node *node)
{
if (node->type != T_AND)
return;
free(node);
}
void ast_and_destruct(s_ast_node *node)
{
if (node->type != T_AND)
......
......@@ -5,7 +5,7 @@
** Login <seblu@epita.fr>
**
** Started on Thu Aug 3 02:41:37 2006 Seblu
** Last update Tue Sep 26 17:45:45 2006 Seblu
** Last update Tue Oct 17 17:12:13 2006 seblu
*/
#include "ast.h"
......@@ -33,6 +33,13 @@ void ast_bang_print(s_ast_node *node, FILE *fs, unsigned int *node_id)
fprintf(fs, "%u -> %u\n", cur_id, lhs_id);
}
void ast_bang_destruct_node(s_ast_node *node)
{
if (node->type != T_BANG)
return;
free(node);
}
void ast_bang_destruct(s_ast_node *node)
{
if (node->type != T_BANG)
......@@ -40,4 +47,3 @@ void ast_bang_destruct(s_ast_node *node)
ast_destruct(node->body.child_bang.lhs);
free(node);
}
......@@ -5,7 +5,7 @@
** Login <seblu@epita.fr>
**
** Started on Thu Aug 3 02:41:37 2006 Seblu
** Last update Wed Oct 11 13:07:50 2006 seblu
** Last update Tue Oct 17 16:36:25 2006 seblu
*/
#include "ast.h"
......@@ -34,7 +34,7 @@ void ast_case_add_item(s_ast_node *node,
item->pattern = pattern;
item->exec = exec;
item->next = NULL;
for (this = &node->body.child_case.items; *this; *this = (*this)->next)
for (this = &node->body.child_case.items; *this; this = &(*this)->next)
; //do nothing
*this = item;
}
......@@ -44,17 +44,19 @@ void ast_case_print(s_ast_node *node, FILE *fs, unsigned *node_id)
unsigned cur_node;
s_case_item *item;
unsigned item_id;
unsigned item_node;
if (node->type != T_CASE)
return;
fprintf(fs, "%u [label = \"CASE\\nword: %s\"];\n",
cur_node = *node_id, node->body.child_case.word);
++*node_id;
//show items
for (item = node->body.child_case.items, item_id = 0;
item;
item = item->next, ++item_id) {
fprintf(fs, "%u -> %u\n", cur_node, *node_id);
fprintf(fs, "%u [ label = \"Item %u\\n", *node_id, item_id);
fprintf(fs, "%u [label = \"Item %u\\n", item_node = *node_id, item_id);
++*node_id;
//print pattern
if (item->pattern)
......@@ -62,11 +64,30 @@ void ast_case_print(s_ast_node *node, FILE *fs, unsigned *node_id)
fprintf(fs, "%s\\n", item->pattern[i]);
fprintf(fs, "\"];\n");
//print exec
if (item->exec)
if (item->exec) {
fprintf(fs, "%u -> %u\n", item_node, *node_id);
ast_print_node(item->exec, fs, node_id);
}
}
}
void ast_case_destruct_node(s_ast_node *node)
{
s_case_item *this, *buf;
if (node->type != T_CASE)
return;
free(node->body.child_case.word);
for (this = node->body.child_case.items; this; this = buf) {
for (register int i = 0; this->pattern[i]; ++i)
free(this->pattern[i]);
free(this->pattern);
buf = this->next;
free(this);
}
free(node);
}
void ast_case_destruct(s_ast_node *node)
{
s_case_item *this, *buf;
......
......@@ -5,7 +5,7 @@
** Login <seblu@epita.fr>
**
** Started on Fri Aug 18 22:13:51 2006 Seblu
** Last update Tue Oct 10 14:27:02 2006 seblu
** Last update Tue Oct 17 17:00:22 2006 seblu
*/
#include "ast.h"
......@@ -83,6 +83,11 @@ void ast_cmd_print(s_ast_node *node, FILE *fs, unsigned int *node_id)
fprintf(fs, "\"];\n");
}
void ast_cmd_destruct_node(s_ast_node *node)
{
ast_cmd_destruct(node);
}
void ast_cmd_destruct(s_ast_node *node)
{
if (node->type != T_CMD)
......
......@@ -5,7 +5,7 @@
** Login <seblu@epita.fr>
**
** Started on Sat Mar 25 23:11:01 2006 Seblu
** Last update Mon Oct 16 18:10:35 2006 seblu
** Last update Tue Oct 17 16:43:29 2006 seblu
*/
#include "ast.h"
......@@ -32,10 +32,28 @@ struct ast_destruct_switch destruction_table[NODE_TYPE_COUNT] =
{T_PIPE, ast_pipe_destruct},
{T_SEPAND, ast_sepand_destruct},
{T_SEP, ast_sep_destruct},
{T_CASE, ast_sepand_destruct},
{T_CASE, ast_case_destruct},
{T_RED, ast_red_destruct}
};
struct ast_destruct_switch destruction_node_table[NODE_TYPE_COUNT] =
{
{T_IF, ast_if_destruct_node},
{T_FOR, ast_for_destruct_node},
{T_WHILE, ast_while_destruct_node},
{T_CMD, ast_cmd_destruct_node},
{T_AND, ast_and_destruct_node},
{T_OR, ast_or_destruct_node},
{T_SUBSHELL, ast_subshell_destruct_node},
{T_FUNCDEC, ast_funcdec_destruct_node},
{T_BANG, ast_bang_destruct_node},
{T_PIPE, ast_pipe_destruct_node},
{T_SEPAND, ast_sepand_destruct_node},
{T_SEP, ast_sep_destruct_node},
{T_CASE, ast_case_destruct_node},
{T_RED, ast_red_destruct_node}
};
void ast_destruct(s_ast_node *ast)
{
if (ast == NULL)
......@@ -46,3 +64,14 @@ void ast_destruct(s_ast_node *ast)
return;
}
}
void ast_destruct_node(s_ast_node *ast)
{
if (ast == NULL)
return;
for (register int i = 0; i < NODE_TYPE_COUNT; ++i)
if (destruction_node_table[i].type == ast->type) {
(destruction_node_table[i].fct)(ast);
return;
}
}
......@@ -5,7 +5,7 @@
** Login <seblu@epita.fr>
**
** Started on Thu Aug 3 02:41:37 2006 Seblu
** Last update Thu Oct 12 16:01:04 2006 seblu
** Last update Tue Oct 17 17:15:27 2006 seblu
*/
#include "ast.h"
......@@ -49,7 +49,7 @@ void ast_for_print(s_ast_node *node, FILE *fs, unsigned *node_id)
}
}
void ast_for_destruct(s_ast_node *node)
void ast_for_destruct_node(s_ast_node *node)
{
if (node->type != T_FOR)
return;
......@@ -57,6 +57,13 @@ void ast_for_destruct(s_ast_node *node)
for (register int i = 0; node->body.child_for.values[i]; ++i)
free(node->body.child_for.values[i]);
free(node->body.child_for.values);
ast_destruct(node->body.child_for.exec);
free(node);
}
void ast_for_destruct(s_ast_node *node)
{
if (node->type != T_FOR)
return;
ast_destruct(node->body.child_for.exec);
ast_for_destruct_node(node);
}
......@@ -5,7 +5,7 @@
** Login <seblu@epita.fr>
**
** Started on Thu Aug 3 02:41:37 2006 Seblu
** Last update Tue Oct 10 14:40:44 2006 seblu
** Last update Wed Oct 18 17:14:16 2006 seblu
*/
#include "ast.h"
......@@ -27,13 +27,21 @@ void ast_funcdec_print(s_ast_node *node, FILE *fs, unsigned *node_id)
if (node->type != T_FUNCDEC)
return;
fprintf(fs, "%u [label = \"FuncDec\\nName: %s\"];\n",
fprintf(fs, "%u [label = \"FuncDec\\nname: %s\"];\n",
cur_id = *node_id, node->body.child_funcdec.name);
lhs_id = ++*node_id;
ast_print_node(node->body.child_funcdec.body, fs, node_id);
fprintf(fs, "%u -> %u\n", cur_id, lhs_id);
}
void ast_funcdec_destruct_node(s_ast_node *node)
{
if (node->type != T_FUNCDEC)
return;
free(node->body.child_funcdec.name);
free(node);
}
void ast_funcdec_destruct(s_ast_node *node)
{
if (node->type != T_FUNCDEC)
......
......@@ -5,7 +5,7 @@
** Login <seblu@epita.fr>
**
** Started on Thu Aug 3 02:41:37 2006 Seblu
** Last update Tue Oct 10 17:15:53 2006 seblu
** Last update Tue Oct 17 16:30:23 2006 seblu
*/
#include "ast.h"
......@@ -49,6 +49,13 @@ void ast_if_print(s_ast_node *node, FILE *fs, unsigned *node_id)
}
}
void ast_if_destruct_node(s_ast_node *node)
{
if (node->type != T_IF)
return;
free(node);
}
void ast_if_destruct(s_ast_node *node)
{
if (node->type != T_IF)
......
......@@ -5,7 +5,7 @@
** Login <seblu@epita.fr>
**
** Started on Thu Aug 3 02:41:37 2006 Seblu
** Last update Tue Sep 26 17:45:54 2006 Seblu
** Last update Tue Oct 17 17:01:20 2006 seblu
*/
#include "ast.h"
......@@ -36,6 +36,13 @@ void ast_or_print(s_ast_node *node, FILE *fs, unsigned int *node_id)
fprintf(fs, "%u -> %u\n", cur_id, rhs_id);
}
void ast_or_destruct_node(s_ast_node *node)
{
if (node->type != T_OR)
return;
free(node);
}
void ast_or_destruct(s_ast_node *node)
{
if (node->type != T_OR)
......
......@@ -5,7 +5,7 @@
** Login <seblu@epita.fr>
**
** Started on Thu Aug 3 02:41:37 2006 Seblu
** Last update Tue Sep 26 17:45:33 2006 Seblu
** Last update Tue Oct 17 17:12:46 2006 seblu
*/
#include "ast.h"
......@@ -36,6 +36,13 @@ void ast_pipe_print(s_ast_node *node, FILE *fs, unsigned int *node_id)
fprintf(fs, "%u -> %u\n", cur_id, rhs_id);
}
void ast_pipe_destruct_node(s_ast_node *node)
{
if (node->type != T_PIPE)
return;
free(node);
}
void ast_pipe_destruct(s_ast_node *node)
{
if (node->type != T_PIPE)
......@@ -44,4 +51,3 @@ void ast_pipe_destruct(s_ast_node *node)
ast_destruct(node->body.child_pipe.rhs);
free(node);
}
......@@ -5,7 +5,7 @@
** Login <seblu@epita.fr>
**
** Started on Fri Aug 18 22:13:51 2006 Seblu
** Last update Mon Oct 16 17:26:11 2006 seblu
** Last update Tue Oct 17 17:16:40 2006 seblu
*/
#include "ast.h"
......@@ -17,6 +17,9 @@ s_ast_node *ast_red_create(void)
secmalloc(node, sizeof (s_ast_node));
node->type = T_RED;
node->body.child_red.size = 0;
node->body.child_red.type = NULL;
node->body.child_red.fd = NULL;
node->body.child_red.word = NULL;
node->body.child_red.mhs = NULL;
return node;
}
......@@ -58,7 +61,7 @@ void ast_red_print(s_ast_node *node, FILE *fs, unsigned *node_id)
ast_print_node(reds-><