2026-01-07 20:18:11 +01:00
|
|
|
#ifndef AST_H
|
|
|
|
|
#define AST_H
|
|
|
|
|
|
2026-01-14 20:32:51 +01:00
|
|
|
#include "utils/ast/ast_command.h"
|
|
|
|
|
#include "utils/ast/ast_if.h"
|
|
|
|
|
#include "utils/ast/ast_list.h"
|
|
|
|
|
#include "utils/ast/ast_void.h"
|
2026-01-07 20:18:11 +01:00
|
|
|
|
|
|
|
|
enum ast_type
|
|
|
|
|
{
|
2026-01-09 22:36:48 +00:00
|
|
|
AST_END,
|
2026-01-13 19:41:37 +01:00
|
|
|
AST_LIST,
|
2026-01-08 18:36:07 +01:00
|
|
|
AST_IF,
|
2026-01-07 20:18:11 +01:00
|
|
|
AST_CMD
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-09 22:36:48 +00:00
|
|
|
struct ast
|
2026-01-08 18:17:02 +01:00
|
|
|
{
|
2026-01-09 22:36:48 +00:00
|
|
|
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;
|
2026-01-07 20:18:11 +01:00
|
|
|
};
|
|
|
|
|
|
2026-01-15 15:53:56 +01:00
|
|
|
/* @brief: returns an ast* with corresponding data and type.
|
|
|
|
|
*
|
|
|
|
|
* @note: this function should only be called by ast_create_[TYPE] functions.
|
|
|
|
|
*/
|
|
|
|
|
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)
|
|
|
|
|
|
2026-01-07 20:18:11 +01:00
|
|
|
#endif /* ! AST_H */
|