summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice <fabrice@schaub-dev.xyz>2026-03-03 07:00:45 +0100
committerFabrice <fabrice@schaub-dev.xyz>2026-03-03 07:00:45 +0100
commit5925f0b1fa68fa05cd4f6738c039284bec6cfe24 (patch)
tree96035024025e4c8ebef8dc60ba97f106f233b957
parent3fa7b0bbeac692c2c66a0e6c451b3ff3c56f1e31 (diff)
use string as file reference
-rw-r--r--src/source.cc6
-rw-r--r--src/token.cc2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/source.cc b/src/source.cc
index b8c04a7..41458af 100644
--- a/src/source.cc
+++ b/src/source.cc
@@ -1,17 +1,16 @@
#ifndef SOURCE_CC
#define SOURCE_CC
-#include "array.cc"
#include "common.cc"
#include "memory.cc"
typedef u32 Source_Id;
struct Span {
- Source_Id id;
+ String file;
usize start, end;
- Span(Source_Id id, usize start, usize end) : id(id), start(start), end(end) {}
+ Span(String file, usize start, usize end) : file(file), start(start), end(end) {}
};
struct Buffer {
@@ -89,7 +88,6 @@ bool buffer_stack_pop(Buffer_Stack* manager, Buffer** b) {
Link* next = link->prev;
link_remove(link);
-
manager->stack = next;
Buffer* buffer = containerof(Buffer, link, link);
diff --git a/src/token.cc b/src/token.cc
index 4a218ef..ea0a4e5 100644
--- a/src/token.cc
+++ b/src/token.cc
@@ -1,6 +1,7 @@
#ifndef TOKEN_CC
#define TOKEN_CC
+#include "source.cc"
#include "common.cc"
#define TOKEN_KINDS_NOLEX \
@@ -25,6 +26,7 @@ enum Token_Kind {
struct Token {
Token_Kind kind;
String text;
+ Span span;
};
#endif