Skip to content

Commit

Permalink
Add current_depth to node printing
Browse files Browse the repository at this point in the history
  • Loading branch information
jnormile committed Oct 12, 2023
1 parent 33afbb2 commit 9697a34
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ast-complexity/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ fn build_tree(source_code: String, mut parser: Parser) {
let mut current_depth = 0;
let mut maximum_depth = 0;
let maximum_depth: i32 = unpack_node(root_node, current_depth, maximum_depth);
println!("");
println!("MAXIMUM DEPTH CALCULATED BY NODE UNPACK IS: {}", maximum_depth);
}

Expand All @@ -81,7 +82,7 @@ fn unpack_node(node: Node, mut current_depth: i32, mut maximum_depth: i32) -> i3
let child_range: Range = child.range();

// Print node ranges (a sanity check to ultimately be removed)
//println!("{} {}", child_range.start_point, child_range.end_point);
println!("{} {} {} {}", current_depth, child_range.start_point, child_range.end_point, child.to_sexp());
current_depth += 1;

if current_depth > maximum_depth {
Expand Down

0 comments on commit 9697a34

Please sign in to comment.