A bunch of array fixes and some buffer stuff that doesn't quite work yet

This commit is contained in:
2025-09-24 14:04:50 +02:00
parent 50a404984d
commit 940b58331d
18 changed files with 261 additions and 137 deletions

View File

@@ -92,6 +92,7 @@ Token_Kind :: enum {
TOKEN_OUT;
TOKEN_PIXEL;
TOKEN_PLEX;
TOKEN_RETURN;
TOKEN_REGISTER;
@@ -247,6 +248,7 @@ identifier_kind :: (using lexer : *Lexer) -> Token_Kind {
if identifier == "return" return .TOKEN_RETURN;
if identifier == "register" return .TOKEN_REGISTER;
if identifier == "struct" return .TOKEN_STRUCT;
if identifier == "plex" return .TOKEN_STRUCT;
if identifier == "switch" return .TOKEN_SWITCH;
if identifier == "true" return .TOKEN_TRUE;
if identifier == "unorm" return .TOKEN_UNORM;
@@ -758,35 +760,31 @@ print_from_source_location :: (ctx : *Compiler_Context, builder : *String_Builde
text.count = tok.length;
print_to_builder(builder, "%", text);
}
return;
} else {
begin_pos := 0;
token_string : string;
count := end.index - begin.index + end.length;
}
if indentation > 0 {
indent(builder, indentation);
for 0..count - 1 {
c := begin.source[it];
if c == #char "\n" {
append(builder, "\n");
indent(builder, indentation);
} else {
s : string;
s.count = 1;
s.data = *c;
print_to_builder(builder, "%", s);
}
begin_pos := 0;
token_string : string;
count := end.index - begin.index + end.length;
if indentation > 0 {
indent(builder, indentation);
for 0..count - 1 {
c := begin.source[it];
if c == #char "\n" {
append(builder, "\n");
indent(builder, indentation);
} else {
s : string;
s.count = 1;
s.data = *c;
print_to_builder(builder, "%", s);
}
} else {
token_string = .{ count = count, data = begin.source };
indent(builder, indentation);
print_to_builder(builder, "%", token_string);
}
} else {
token_string = .{ count = count, data = begin.source };
indent(builder, indentation);
print_to_builder(builder, "%", token_string);
}
}