From 27c0cafdfc66ce731156bf076644716f240318d4 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Tue, 27 Jan 2026 13:19:23 +0000 Subject: Support for custom attributes --- src/ast/ast.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/ast') diff --git a/src/ast/ast.h b/src/ast/ast.h index 967f27f..b272cae 100644 --- a/src/ast/ast.h +++ b/src/ast/ast.h @@ -157,6 +157,14 @@ typedef enum } NodeType; // ** AST Node Structure ** +typedef struct Attribute +{ + char *name; + char **args; + int arg_count; + struct Attribute *next; +} Attribute; + struct ASTNode { NodeType type; @@ -212,6 +220,8 @@ struct ASTNode int cuda_global; // @global -> __global__ int cuda_device; // @device -> __device__ int cuda_host; // @host -> __host__ + + Attribute *attributes; // Custom attributes } func; struct @@ -419,11 +429,12 @@ struct ASTNode int generic_param_count; // Number of generic parameters char *parent; int is_union; - int is_packed; // @packed attribute. - int align; // @align(N) attribute, 0 = default. - int is_incomplete; // Forward declaration (prototype) - int is_export; // @export attribute - char **used_structs; // Names of structs used/mixed-in + int is_packed; // @packed attribute. + int align; // @align(N) attribute, 0 = default. + int is_incomplete; // Forward declaration (prototype) + int is_export; // @export attribute + Attribute *attributes; // Custom attributes + char **used_structs; // Names of structs used/mixed-in int used_struct_count; } strct; -- cgit v1.2.3