Root pointer instead of a loop

This commit is contained in:
2026-07-14 11:44:56 +02:00
parent 3499cf82d5
commit 95d5ae2c9e
+1 -6
View File
@@ -1,6 +1,5 @@
package main
import "core:fmt"
import "core:strings"
TokenType :: enum {
@@ -26,8 +25,6 @@ Token :: struct {
parent: ^Token,
}
current_token: ^Token
replace_text :: proc(text: string, start: int, len_: int, repl: string) -> string {
builder := strings.builder_make(context.temp_allocator)
strings.write_string(&builder, text[:start])
@@ -60,9 +57,7 @@ parse :: proc(lines: []string, allocator := context.allocator) -> Token {
if len(line) == 0 {
if line_index != len(lines) - 1 {
for current_token.parent != nil {
current_token = current_token.parent
}
current_token = &root
append(
&current_token.children,