summaryrefslogtreecommitdiff
path: root/42sh/src/exec/ast_eval.h
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
commit967be9e750221ab2ab783f95df79bb26d290a45e (patch)
tree6802900a5e975f9f68b169f0f503f040056d6952 /42sh/src/exec/ast_eval.h
add: added projectsHEADmain
Diffstat (limited to '42sh/src/exec/ast_eval.h')
-rw-r--r--42sh/src/exec/ast_eval.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/42sh/src/exec/ast_eval.h b/42sh/src/exec/ast_eval.h
new file mode 100644
index 0000000..785df5a
--- /dev/null
+++ b/42sh/src/exec/ast_eval.h
@@ -0,0 +1,24 @@
+#ifndef AST_EVAL_H
+#define AST_EVAL_H
+
+#include "ast/ast.h"
+
+/**
+ * @brief Shell true value, this is not the builtin true.
+ */
+#define SHELL_TRUE 0
+
+/**
+ * @brief Shell false value, this is not the builtin false.
+ */
+#define SHELL_FALSE 1
+
+/**
+ * @brief Returns the exit code of the given AST.
+ * @param ast The AST to evaluate. It is given as a `struct ast*`
+ * and uses an inheritance-like principle.
+ * An AST can be of any type from the `enum ast_node`.
+ */
+int eval_ast(struct ast *ast);
+
+#endif /* ! AST_EVAL_H */