Pass through children

This commit is contained in:
2026-07-14 15:04:39 +02:00
parent 4f03c5bf9a
commit e61011ca5f
+20
View File
@@ -51,10 +51,24 @@ parse_header :: proc(line: string) -> (int, string) {
return lvl, line[lvl + 1:]
}
pass_through_children :: proc(token: ^Token) {
if token.children != nil {
for child in token.children {
pass_through_children(child)
}
}
if token.type == TokenType.Text {
}
}
parse :: proc(lines: []string, allocator := context.allocator) -> Token {
root := Token{TokenType.Root, nil, nil, nil}
current_token := &root
// FIRST PASS
for untrimmed_line, line_index in lines {
line := strings.trim_space(untrimmed_line)
@@ -126,5 +140,11 @@ parse :: proc(lines: []string, allocator := context.allocator) -> Token {
}
}
// SECOND PASS
for token in root.children {
pass_through_children(token)
}
return root
}