From 95d5ae2c9ea4c406c054b59d53c20c4b0f7e2db2 Mon Sep 17 00:00:00 2001 From: "N0\\A" Date: Tue, 14 Jul 2026 11:44:56 +0200 Subject: [PATCH] Root pointer instead of a loop --- src/parser.odin | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/parser.odin b/src/parser.odin index 94301a3..8c4327a 100644 --- a/src/parser.odin +++ b/src/parser.odin @@ -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( ¤t_token.children,