42sh/src/utils/ast/ast.h

38 lines
407 B
C
Raw Normal View History

#ifndef AST_H
#define AST_H
2026-01-08 18:17:02 +01:00
#include "lists.h"
enum ast_type
{
2026-01-08 18:17:02 +01:00
AST_END = 0,
2026-01-08 18:36:07 +01:00
AST_IF,
AST_CMD
};
2026-01-08 18:17:02 +01:00
union ast_node
{
2026-01-08 18:17:02 +01:00
struct ast_if;
struct ast_cmd;
};
struct ast
{
enum ast_type type;
2026-01-08 18:17:02 +01:00
union ast_node data;
};
struct ast_if
{
struct ast* condition;
struct ast* then_clause;
struct ast* else_clause;
};
struct ast_cmd
{
struct list* cmd;
};
#endif /* ! AST_H */