From dcf7e86ba7ae9918bda1122dd8cb51d396920696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Mon, 23 Dec 2024 00:11:26 +0200 Subject: [PATCH] more fields --- ast.h | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/ast.h b/ast.h index 69c9b3a..b62caa9 100644 --- a/ast.h +++ b/ast.h @@ -519,6 +519,81 @@ typedef struct { AstExtraData extra_data; } Ast; +typedef struct AstPtrType { + AstNodeIndex sentinel; + AstNodeIndex align_node; + AstNodeIndex addrspace_node; +} AstPtrType; + +typedef struct AstPtrTypeBitRange { + AstNodeIndex sentinel; + AstNodeIndex align_node; + AstNodeIndex addrspace_node; + AstNodeIndex bit_range_start; + AstNodeIndex bit_range_end; +} AstPtrTypeBitRange; + +typedef struct AstFnProtoOne { + AstNodeIndex param; + AstNodeIndex align_expr; + AstNodeIndex addrspace_expr; + AstNodeIndex section_expr; + AstNodeIndex callconv_expr; +} AstFnProtoOne; + +typedef struct AstFnProto { + AstNodeIndex params_start; + AstNodeIndex params_end; + AstNodeIndex align_expr; + AstNodeIndex addrspace_expr; + AstNodeIndex section_expr; + AstNodeIndex callconv_expr; +} AstFnProto; + +typedef struct AstSubRange { + AstNodeIndex start; + AstNodeIndex end; +} AstSubRange; + +typedef struct AstSliceSentinel { + AstNodeIndex start; + AstNodeIndex end; + AstNodeIndex sentinel; +} AstSliceSentinel; + +typedef struct AstWhileCont { + AstNodeIndex cont_expr; + AstNodeIndex then_expr; +} AstWhileCont; + +typedef struct AstWhile { + AstNodeIndex cont_expr; + AstNodeIndex then_expr; + AstNodeIndex else_expr; +} AstWhile; + +typedef struct AstFor { + unsigned int inputs : 31; + unsigned int has_else : 1; +} AstFor; + +typedef struct AstIf { + AstNodeIndex then_expr; + AstNodeIndex else_expr; +} AstIf; + +typedef struct AstError { + bool is_note; + AstTokenIndex token; + union { + struct { + TokenizerTag expected_tag; + } expected; + struct { + } none; + } extra; +} AstError; + Ast astParse(const char* source, uint32_t len); // MultiArrayList