This commit is contained in:
2026-07-13 14:24:56 +02:00
parent ff76b54802
commit 66145f516e
+27
View File
@@ -3,6 +3,33 @@ package main
import "core:fmt" import "core:fmt"
import "core:strings" import "core:strings"
TokenType :: enum {
Text,
Italics,
Bold,
BreakLine,
Heading,
}
TokenMode :: enum {
Start,
End,
}
TokenValue :: union {
string,
int,
TokenMode,
}
Token :: struct {
type: TokenType,
value: TokenValue,
child: [dynamic]Token,
}
token_tree := [dynamic]Token{}
replace_text :: proc(text: string, start: int, len_: int, repl: string) -> string { replace_text :: proc(text: string, start: int, len_: int, repl: string) -> string {
builder := strings.builder_make(context.temp_allocator) builder := strings.builder_make(context.temp_allocator)
strings.write_string(&builder, text[:start]) strings.write_string(&builder, text[:start])