Types
This commit is contained in:
@@ -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])
|
||||||
|
|||||||
Reference in New Issue
Block a user