Implement String structure and update Location/Token to use it

This commit is contained in:
2026-04-25 14:17:17 +02:00
parent 902e2f0325
commit 116bdecafe
9 changed files with 73 additions and 35 deletions
+3 -3
View File
@@ -16,14 +16,14 @@ Module* parser_parse(TokenStream* ts) {
Module* module = (Module*)malloc(sizeof(Module));
if (module == NULL) return NULL;
module->name = (char*)malloc(t.text_length + 1);
module->name = (char*)malloc(t.text.length + 1);
if (module->name == NULL) {
free(module);
return NULL;
}
memcpy(module->name, t.text, t.text_length);
module->name[t.text_length] = '\0';
memcpy(module->name, t.text.data, t.text.length);
module->name[t.text.length] = '\0';
t = tokenstream_next(ts);
if (t.token != TOKEN_SEMICOLON) {