summaryrefslogtreecommitdiff
path: root/src/compiler/ast-tree.h
diff options
context:
space:
mode:
authorA404M <ahmadmahmoudiprogrammer@gmail.com>2025-04-05 15:09:23 +0330
committerA404M <ahmadmahmoudiprogrammer@gmail.com>2025-04-05 15:09:23 +0330
commitb5772e1c6961dd4b99b91b060b57584d4868aa2b (patch)
tree0b2d3c4f9b4d58981439e027423129ff0f427572 /src/compiler/ast-tree.h
parent5d43a23a42725d9e88be76ce04260dbd4b57d370 (diff)
working on access operator
Diffstat (limited to 'src/compiler/ast-tree.h')
-rw-r--r--src/compiler/ast-tree.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/compiler/ast-tree.h b/src/compiler/ast-tree.h
index 00f477c..fdc797e 100644
--- a/src/compiler/ast-tree.h
+++ b/src/compiler/ast-tree.h
@@ -61,6 +61,7 @@ typedef enum AstTreeToken {
AST_TREE_TOKEN_OPERATOR_POINTER,
AST_TREE_TOKEN_OPERATOR_ADDRESS,
AST_TREE_TOKEN_OPERATOR_DEREFERENCE,
+ AST_TREE_TOKEN_OPERATOR_ACCESS,
AST_TREE_TOKEN_SCOPE,
@@ -194,6 +195,19 @@ typedef struct AstTreeStruct {
AstTreeVariables variables;
} AstTreeStruct;
+typedef struct AstTreeName {
+ char *begin;
+ char *end;
+} AstTreeName;
+
+typedef struct AstTreeAccess {
+ AstTree *object;
+ struct {
+ AstTreeName name;
+ size_t index;
+ } member;
+} AstTreeAccess;
+
void astTreePrint(const AstTree *tree, int indent);
void astTreeVariablePrint(const AstTreeVariable *variable, int indent);
void astTreeRootPrint(const AstTreeRoot *root);
@@ -251,6 +265,8 @@ AstTree *astTreeParseCurlyBracket(ParserNode *parserNode,
AstTreeHelper *helper);
AstTree *astTreeParseParenthesis(ParserNode *parserNode, AstTreeHelper *helper);
AstTree *astTreeParseStruct(ParserNode *parserNode, AstTreeHelper *helper);
+AstTree *astTreeParseAccessOperator(ParserNode *parserNode,
+ AstTreeHelper *helper, AstTreeToken token);
bool isFunction(AstTree *value);
bool isConst(AstTree *tree, AstTreeHelper *helper);
@@ -299,7 +315,10 @@ bool setTypesScope(AstTree *tree, AstTreeSetTypesHelper helper,
AstTreeFunction *function);
bool setTypesComptime(AstTree *tree, AstTreeSetTypesHelper helper);
bool setTypesStruct(AstTree *tree, AstTreeSetTypesHelper helper);
+bool setTypesOperatorAccess(AstTree *tree, AstTreeSetTypesHelper helper);
bool setTypesAstVariable(AstTreeVariable *variable,
AstTreeSetTypesHelper helper);
bool setTypesAstInfix(AstTreeInfix *infix, AstTreeSetTypesHelper helper);
+
+size_t sizeOfType(AstTree *type);