Refactor Token to use Location struct

This commit is contained in:
2026-04-24 22:07:00 +02:00
parent a89e61eedd
commit 26a1d0285e
4 changed files with 42 additions and 24 deletions
+4 -4
View File
@@ -101,8 +101,8 @@ static void test_tokenstream_info(void) {
memcpy(buf1, t1.text, t1.text_length);
buf1[t1.text_length] = '\0';
assert_str("module", buf1, "info: expected 'module'");
if (t1.line != 1) fail("expected line 1");
if (t1.column != 1) fail("expected column 1");
if (t1.location.line != 1) fail("expected line 1");
if (t1.location.column != 1) fail("expected column 1");
Token t2 = tokenstream_next(ts);
if (t2.token != TOKEN_IDENTIFIER) fail("expected TOKEN_IDENTIFIER");
@@ -111,8 +111,8 @@ static void test_tokenstream_info(void) {
memcpy(buf2, t2.text, t2.text_length);
buf2[t2.text_length] = '\0';
assert_str("main", buf2, "info: expected 'main'");
if (t2.line != 1) fail("expected line 1");
if (t2.column != 8) fail("expected column 8");
if (t2.location.line != 1) fail("expected line 1");
if (t2.location.column != 8) fail("expected column 8");
tokenstream_close(ts);
}