Created a tokenizer and the supporting code, currently processes text that is not a string literal.

This commit is contained in:
2025-01-07 23:52:03 -06:00
parent 2c85077031
commit 7e70c6fd19
10 changed files with 351 additions and 12 deletions
+28
View File
@@ -0,0 +1,28 @@
#include "../includes/array.h"
#include <stdlib.h>
#define ARRAY_DEFAULT_CAPACITY 32
struct _array* ArrayCreate(void) {
struct _array* array = calloc(1, sizeof(Array));
array->Items = calloc(ARRAY_DEFAULT_CAPACITY, sizeof(void*));
array->Capacity = ARRAY_DEFAULT_CAPACITY;
return array;
}
int ArrayAdd(struct _array* array, void* item) {
if (!array) return 0;
if (array->Size == array->Capacity) {
array->Items = realloc(array->Items, array->Capacity * 2 * sizeof(void*));
array->Capacity *= 2;
}
array->Items[array->Size] = item;
array->Size++;
return 1;
}