summaryrefslogtreecommitdiff
path: root/src/compiler/ast-tree.h
diff options
context:
space:
mode:
authorA404M <ahmadmahmoudiprogrammer@gmail.com>2025-04-23 15:39:11 +0330
committerA404M <ahmadmahmoudiprogrammer@gmail.com>2025-04-23 15:39:11 +0330
commitf91fc3bac670a8c775c7ea7b8ba8789dba9559ad (patch)
treee227022c0c2fa09fc52f47519f3c1815590651b8 /src/compiler/ast-tree.h
parent157475f0bd929a9b42b6cd9a4ca7f4fc4e64bf71 (diff)
prepairing more for importing
Diffstat (limited to 'src/compiler/ast-tree.h')
-rw-r--r--src/compiler/ast-tree.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/compiler/ast-tree.h b/src/compiler/ast-tree.h
index 0360f7e..300be41 100644
--- a/src/compiler/ast-tree.h
+++ b/src/compiler/ast-tree.h
@@ -128,8 +128,17 @@ typedef struct AstTrees {
typedef struct AstTreeRoot {
AstTreeVariables variables;
AstTrees trees;
+ char **imported;
+ size_t imported_size;
} AstTreeRoot;
+typedef struct AstTreeRoots {
+ AstTreeRoot **data;
+ size_t size;
+} AstTreeRoots;
+
+extern AstTreeRoots AST_TREE_ROOTS_ERROR;
+
typedef struct AstTreeScope {
AstTreeVariables variables;
AstTree **expressions;
@@ -237,6 +246,7 @@ typedef struct AstTreeBracket {
typedef enum AstTreeBuiltinToken {
AST_TREE_BUILTIN_TOKEN_CAST,
AST_TREE_BUILTIN_TOKEN_TYPE_OF,
+ AST_TREE_BUILTIN_TOKEN_IMPORT,
AST_TREE_BUILTIN_TOKEN__SIZE__,
} AstTreeBuiltinToken;
@@ -256,6 +266,7 @@ void astTreeVariableDelete(AstTreeVariable *variable);
void astTreeDelete(AstTree *tree);
bool astTreeShouldDelete(AstTree *tree);
void astTreeRootDelete(AstTreeRoot *root);
+void astTreeRootsDestroy(AstTreeRoots roots);
AstTree *newAstTree(AstTreeToken token, void *metadata, AstTree *type,
char *str_begin, char *str_end);
@@ -268,7 +279,8 @@ AstTreeVariables copyAstTreeVariables(AstTreeVariables variables,
AstTreeVariables newVariables[],
size_t variables_size);
-AstTreeRoot *makeAstTree(ParserNode *parsedRoot);
+AstTreeRoots makeAstTree(const char *filePath);
+AstTreeRoot *makeAstRoot(ParserNode *parsedRoot);
bool pushVariable(AstTreeHelper *helper, AstTreeVariables *variables,
AstTreeVariable *variable);
@@ -368,3 +380,5 @@ bool setTypesArrayAccess(AstTree *tree, AstTreeSetTypesHelper helper);
bool setTypesAstVariable(AstTreeVariable *variable,
AstTreeSetTypesHelper helper);
bool setTypesAstInfix(AstTreeInfix *infix, AstTreeSetTypesHelper helper);
+
+char *u8ArrayToCString(AstTree *tree);