making tcc happier

This commit is contained in:
2024-12-27 12:34:08 +02:00
parent 6ae7d7320d
commit 6006a802e1
10 changed files with 416 additions and 274 deletions

21
ast.h
View File

@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "common.h"
#include "tokenizer.h"
typedef enum {
@@ -498,6 +499,12 @@ typedef struct {
AstData* datas;
} AstNodeList;
typedef struct {
AstNodeTag tag;
AstTokenIndex main_token;
AstData data;
} AstNodeItem;
typedef struct {
uint32_t len;
uint32_t cap;
@@ -505,18 +512,14 @@ typedef struct {
AstIndex* starts;
} AstTokenList;
typedef struct {
uint32_t len;
uint32_t cap;
AstNodeIndex* arr;
} AstExtraData;
typedef SLICE(AstNodeIndex) AstNodeIndexSlice;
typedef struct {
const char* source;
uint32_t source_len;
AstTokenList tokens;
AstNodeList nodes;
AstExtraData extra_data;
AstNodeIndexSlice extra_data;
} Ast;
typedef struct AstPtrType {
@@ -596,11 +599,7 @@ typedef struct AstError {
Ast astParse(const char* source, uint32_t len);
// MultiArrayList
void astNodeListEnsureCapacity(AstNodeList* list, uint32_t additional);
void astTokenListEnsureCapacity(AstTokenList* list, uint32_t additional);
AstNodeIndex astNodeListAppend(AstNodeList* list, AstNodeTag tag, AstTokenIndex main_token, AstData data);
AstNodeIndex astNodeListAppend(AstNodeList*, AstNodeItem);
void astTokenListAppend(AstTokenList* list, TokenizerTag tag, AstIndex start);
#endif