refactor(ast): one file per ast_type -- FINISHED
This commit is contained in:
parent
38f5a35885
commit
30df2993ee
10 changed files with 85 additions and 51 deletions
|
|
@ -1,32 +1,12 @@
|
|||
#ifndef AST_H
|
||||
#define AST_H
|
||||
|
||||
#include "utils/ast/ast_base.h"
|
||||
#include "utils/ast/ast_command.h"
|
||||
#include "utils/ast/ast_if.h"
|
||||
#include "utils/ast/ast_list.h"
|
||||
#include "utils/ast/ast_void.h"
|
||||
|
||||
enum ast_type
|
||||
{
|
||||
AST_END,
|
||||
AST_LIST,
|
||||
AST_IF,
|
||||
AST_CMD
|
||||
};
|
||||
|
||||
struct ast
|
||||
{
|
||||
enum ast_type type;
|
||||
|
||||
/**
|
||||
* Data associated with this AST node. It can be one of the following:
|
||||
* - NULL (AST_END)
|
||||
* - struct ast_if* (AST_IF)
|
||||
* - struct ast_cmd* (AST_CMD)
|
||||
*/
|
||||
void *data;
|
||||
};
|
||||
|
||||
/* @brief: returns an ast* with corresponding data and type.
|
||||
*
|
||||
* @note: this function should only be called by ast_create_[TYPE] functions.
|
||||
|
|
@ -36,6 +16,6 @@ struct ast *ast_create(enum ast_type type, void *data);
|
|||
/* @brief: frees the given ast. If ast is NULL, does nothing.
|
||||
*
|
||||
*/
|
||||
void ast_free(struct ast *node)
|
||||
void ast_free(struct ast *node);
|
||||
|
||||
#endif /* ! AST_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue