Implement String structure and update Location/Token to use it
This commit is contained in:
+3
-3
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user