From 34099f0d7752a2fab5eadccfeb578b77b292c889 Mon Sep 17 00:00:00 2001 From: A404M Date: Fri, 7 Feb 2025 22:16:18 +0330 Subject: add return --- src/compiler/ast-tree.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/compiler/ast-tree.h') diff --git a/src/compiler/ast-tree.h b/src/compiler/ast-tree.h index 28e74af..64068d3 100644 --- a/src/compiler/ast-tree.h +++ b/src/compiler/ast-tree.h @@ -8,6 +8,7 @@ typedef enum AstTreeToken { AST_TREE_TOKEN_FUNCTION, AST_TREE_TOKEN_KEYWORD_PRINT_U64, + AST_TREE_TOKEN_KEYWORD_RETURN, AST_TREE_TOKEN_TYPE_TYPE, AST_TREE_TOKEN_TYPE_FUNCTION, @@ -88,6 +89,10 @@ typedef struct AstTreeInfix { AstTree right; } AstTreeInfix; +typedef struct AstTreeReturn { + AstTree *value; +} AstTreeReturn; + void astTreePrint(const AstTree *tree, int indent); void astTreeRootPrint(const AstTreeRoot *root); @@ -129,6 +134,9 @@ AstTree *astTreeParseIdentifier(ParserNode *parserNode, AstTree *astTreeParsePrintU64(ParserNode *parserNode, AstTreeVariables **variables, size_t variables_size); +AstTree *astTreeParseReturn(ParserNode *parserNode, + AstTreeVariables **variables, + size_t variables_size); AstTree *astTreeParseAssign(ParserNode *parserNode, AstTreeVariables **variables, @@ -150,9 +158,10 @@ AstTree *makeTypeOf(AstTree *value); bool typeIsEqual(const AstTree *type0, const AstTree *type1); bool setAllTypesRoot(AstTreeRoot *root); -bool setAllTypes(AstTree *tree); +bool setAllTypes(AstTree *tree,AstTreeFunction *function); bool setTypesFunction(AstTree *tree); bool setTypesPrintU64(AstTree *tree); +bool setTypesReturn(AstTree *tree,AstTreeFunction *function); bool setTypesTypeFunction(AstTree *tree); bool setTypesFunctionCall(AstTree *tree); bool setTypesVariable(AstTree *tree); -- cgit v1.2.3