Remove TokenMode

This commit is contained in:
2026-07-13 14:36:02 +02:00
parent 4f3226b0b7
commit f875b2917a
2 changed files with 2 additions and 18 deletions
-9
View File
@@ -35,15 +35,6 @@ print_token :: proc(token: Token, depth: int) {
value_str = v
case int:
value_str = fmt.aprintf("%d", v, allocator = context.temp_allocator)
case TokenMode:
switch v {
case TokenMode.Start:
value_str = "Start"
case TokenMode.End:
value_str = "End"
case TokenMode.Modeless:
value_str = "Modeless"
}
}
if value_str != "" {
+2 -9
View File
@@ -12,16 +12,9 @@ TokenType :: enum {
Paragraph,
}
TokenMode :: enum {
Start,
End,
Modeless,
}
TokenValue :: union {
string,
int,
TokenMode,
}
Token :: struct {
@@ -58,14 +51,14 @@ parse_header :: proc(line: string) -> (int, string) {
parse :: proc(lines: []string, allocator := context.allocator) -> [dynamic]Token {
token_tree := [dynamic]Token{}
append(&token_tree, Token{TokenType.Paragraph, TokenMode.Start, nil})
append(&token_tree, Token{TokenType.Paragraph, nil, nil})
current_token := &token_tree[0]
for untrimmed_line in lines {
line := strings.trim_space(untrimmed_line)
if len(line) == 0 {
append(&current_token.children, Token{TokenType.BreakLine, TokenMode.Modeless, nil})
append(&current_token.children, Token{TokenType.BreakLine, nil, nil})
continue
}