Pass through children
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user